I'm making a macro that opens Internet Explorer, navigates and logs into a website. Everything works fine, but I need to bring the IE Window up front, and activate it, so I can use SendKeys
on it.
I've found websites and videos with different approaches on a command called AppActivate
and i've tried many of them, but even if I copy the entire code (which works for the author) it won't work for me, I always get an error: Invalid Procedure Call or Argument - Error 5
A list of everything I've found and tried:
Dim objIE As InternetExplorerMedium
Set objIE = New InternetExplorerMedium
objIE.navigate "http://google.com"
'makes it visible, but not active
objIE.Visible = True
'A list of ways I've tried:
objIE.AppActivate "Google - Internet Explorer"
AppActivate "Google - internet Explorer"
'the above supposedly looks for the title of the page
AppActivate objIE
AppActivate (objIE)
AppActivate "objIE"
observations: I'm running this inside Excel 2013 and I'm using Windows 7 with IE 11.