Hello,
I have a piece of code that opens a webpage in internet explorer.
I then want the next section of the code (just picks information off the webpage referring to specific elements) to run only when 'the user' types in a search and navigates to the search results page. The program would then revert back to the original search page and repeat the process.
This is the code i have so far:
*??? what needs to go in this gap in code ???*
Will I also need to add another Do loop to wait for the new webpage to load when the user has navigated to it?
I realise this method leaves room for error in that if a different link is clicked by the user, the next section of code looking at specific webpage elements may not work. However, I will be the only person using the code, so this doesnt matter.
Thank you in advance,
killpaddy
I have a piece of code that opens a webpage in internet explorer.
I then want the next section of the code (just picks information off the webpage referring to specific elements) to run only when 'the user' types in a search and navigates to the search results page. The program would then revert back to the original search page and repeat the process.
This is the code i have so far:
Code:
Set ie = New InternetExplorerMedium
ie.Visible = True
'sets up loop to load webpage ready for new info to be entered on each pass
For i = 1 to lastrow
'open webpage
ie.navigate "about:blank"ie.navigate ("http://www.mrexcel.com/forum/")
'wait to load
Do
If ie.ReadyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
'Wait to load AND for user to navigate away from webpage
Do
If ie.ReadyState = 4 And Not *??? ie.address = "http://www.mrexcel.com/forum/" ???* Then
'Another wait needed???
ie.Document.getelementbyid("quick_search_input").Value = PRODREF
...
...
Exit Do
Else
DoEvents
End If
Loop
'Performs actions with 'PRODREF' and other retrieved variables from the webpage
Next
*??? what needs to go in this gap in code ???*
Will I also need to add another Do loop to wait for the new webpage to load when the user has navigated to it?
I realise this method leaves room for error in that if a different link is clicked by the user, the next section of code looking at specific webpage elements may not work. However, I will be the only person using the code, so this doesnt matter.
Thank you in advance,
killpaddy