Hello,
Below is the code I have been working on to open up google using send keys. Normally I use the waitime function I made below to guess when a page has loaded all the way. However sometimes the web page takes longer to open than other times. Is there any way that I can make the loop I have placed in the code work as a way of waiting until the page is loaded before it starts going down the list of send keys? Any help is appreciated! thanks in advance!
Below is the code I have been working on to open up google using send keys. Normally I use the waitime function I made below to guess when a page has loaded all the way. However sometimes the web page takes longer to open than other times. Is there any way that I can make the loop I have placed in the code work as a way of waiting until the page is loaded before it starts going down the list of send keys? Any help is appreciated! thanks in advance!
Code:
Sub openTest()
file_path = "C:\Program Files (x86)\Mozilla Firefox\firefox.exe"
Call Shell(file_path, vbNormalFocus)
Do
Loop Until file_path.readyState = READYSTATE_COMPLETE
Call SendKeys("^e", True)
Call SendKeys("+{TAB}", True)
waitTime (2000)
Call SendKeys("www.google.com", True)
Call SendKeys("{ENTER}", True)
End Sub
Function waitTime(ByVal milliSeconds As Double)
Application.Wait (Now() + milliSeconds / 24 / 60 / 60 / 1000)
End Function