Question : Access 2007 Webbrowser Active X Control

Using the Webbrowser control I am able to bring up a website using Me.Web02.navigate "www.myspace.com".  Once the page is loaded, I need to pass a username (email) and password and submit the values to login. I really need some help here.  I can usually find the answers to my questions on the search engines, but I can only find two articles about this, and both examples fail.  Here is what I have tried;


If Me.Web01.ReadyState = WebBrowserReadyState.Complete Then
            Web01.Document.GetElementById("ctl00_ctl00_cpMain_cpMain_LoginBox_Email_Textbox").InnerText = me.strusername
            Web01.Document.GetElementById("ctl00_ctl00_cpMain_cpMain_LoginBox_Password_Textbox").InnerText = me.strpassword
            Web01.Document.GetElementById("dbl").RaiseEvent ("onclick")
End If

I also tried

Set Web01 = Me!WebBrowser2.Object

    With Web01

      Do While .Busy: DoEvents: Loop
        Do While .ReadyState < 4: DoEvents: Loop
     
            With .Document.Forms(0)
                .Email.Value = Me.strUserName
                .[Password].Value = Me.strPassword
                .[ctl00$Main$SplashDisplay$login$loginbutton].Click
                .submit
        End With
           
   End With

And I tried a million varations of each.  The code compiles, but generates runtime errors.  Again, my goal is simply to nav to myspace, pass the user/pass credentials and login.  If anyone can help, I would greatly appericiate it.

Answer : Access 2007 Webbrowser Active X Control

You were almost there.

Try this:-

Web01.Document.GetElementById("ctl00_ctl00_cpMain_cpMain_LoginBox_Email_Textbox").InnerText = me.strusername
Web01.Document.GetElementById("ctl00_ctl00_cpMain_cpMain_LoginBox_Password_Textbox").InnerText = me.strpassword
Web01.Document.Forms("LoginForm").submit

DJ
Random Solutions  
 
programming4us programming4us