Run Time Error 424 - Object Required - Why?

ebbo

Registered User.
Local time
Today, 20:11
Joined
Sep 2, 2009
Messages
30
Private Sub MyBtn_Click()
Dim browser As WebBrowser
Dim SearchValue As String
Set browser = CreateObject("InternetExplorer.Application")

browser.Visible = True
browser.Navigate ("www.mywebsite.com")

'Wait for the page to load
Do While browser.Busy Or browser.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop

browser.Document.loginform.usrname.Value = "MyUserName"
browser.Document.loginform.pass.Value = "MyPassword"
browser.Document.loginform.submit.Click

browser.Navigate ("www.mywebsite.com/admin/index.php") '

'Wait for the page to load
Do While browser.Busy Or browser.ReadyState <> READYSTATE_COMPLETE
DoEvents
Loop

browser.Document.adminForm.search.Value = SearchValue
browser.Document.adminForm.submit.Click

End Sub


Is it that I am not finding the correct object on the web page? or is something wrong with the way I have formed the code?

EDIT: I found out that i Should not use submit.Click if there is nothing to click! So i have just changed it to .submit

However now I have an additional problem. I can get the webpage to open - but how do i force the webpage to do nothing until its fully loaded. The code I used was working until i restarted my application. Now for whatever reason it is not logging in any more - I think its logging in to fast. What is the correct way to make sure the browser web page has fully loaded?
 
Last edited:

Users who are viewing this thread

Back
Top Bottom