hi,
I have created a macro to access web page using VBA in Excel.
The macro is working as per the code.
But while the macro is running, if i switch to some other window, it executes the rest of the macro commands there.
For E.g.:
I run macro to open google, and then use SendKeys to enter the string in the search and use SendKeys again to Tab thru the page 2 times, till i reach I'm Feeling Lucky button. then press enter.
When i click run, the web page opens and the google is displayed. And rest works fine as wel.
but while it's running, if i open other any other application, for e.g. word doc, then the rest of the code, like Tabbing for 2 times, is done in that word.
Can anyone suggest a code which can activate the window used by macro, n use it by default for further actions, even if i navigate away from the window?
My code is:
Dim newIE As Object
Dim newHour
Dim newMinute
Dim newSecond
Dim waitTime
Set newIE = CreateObject("InternetExplorer.Application")
newIE.Navigate "http://google.com/"
newIE.Visible = True
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 10
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.Wait waitTime
SendKeys "XYZ"
SendKeys "{TAB 2}", True
SendKeys "{ENTER}", True
Thanks in advance
Bookmarks