g***@pnmac.com
2018-04-24 17:51:44 UTC
i. I have the following, which makes my code go to the already open instance of IE to change values in select dropdowns.. but if there is more than 1 IE window open, it sometimes goes to the wrong window if i happen to click on another already opened IE window.. can someone tell me how i can add code to go to a SPECIFIC window and only that window? Sometimes the same website is open in more than 1 window.. so I am sure that complicates things even more... Here is my code so far..
'-------------------------------------------------------------------------------------------
'INTERACT WITH ALREADY OPEN ie
WScript.Sleep 4000 '1000 = 1 second
Dim oIE
Dim ShellApp
Set ShellApp = CreateObject("Shell.Application")
Dim ShellWindows
Set ShellWindows = ShellApp.Windows()
For Each ShellApp In ShellWindows
If UCase(ShellApp.FullName) = UCase("C:\Program Files (x86)\Internet Explorer\iexplore.exe") Then
If Left(UCase(ShellApp.LocationURL), Len("https://websiteNAME.html")) = UCase("https://websiteNAME.html") Then
Set oIE = ShellApp
End If
End If
Next
Do Until oIE.Busy = False
DoEvents
Loop
With oIE
...
'-------------------------------------------------------------------------------------------
'INTERACT WITH ALREADY OPEN ie
WScript.Sleep 4000 '1000 = 1 second
Dim oIE
Dim ShellApp
Set ShellApp = CreateObject("Shell.Application")
Dim ShellWindows
Set ShellWindows = ShellApp.Windows()
For Each ShellApp In ShellWindows
If UCase(ShellApp.FullName) = UCase("C:\Program Files (x86)\Internet Explorer\iexplore.exe") Then
If Left(UCase(ShellApp.LocationURL), Len("https://websiteNAME.html")) = UCase("https://websiteNAME.html") Then
Set oIE = ShellApp
End If
End If
Next
Do Until oIE.Busy = False
DoEvents
Loop
With oIE
...