python_dude
08-27-2014, 02:20 AM
Hi everyone,
I have some code that retrieves data from multiple websites via Internet Explorer automation in VBA. My code worked without problems with IE8, but in IE11, after the Navigate method of the Internet Explorer object is called, the Document and LocationURL are not updated; they still refer to the previously displayed website. Here's some code to reproduce the problem:
Sub Test()
Debug.Print "start"
Dim ie
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate url1
wait ie
Debug.Print "Current URL: " & ie.LocationURL
ie.Navigate url2
wait ie
Debug.Print "Current URL: " & ie.LocationURL
Set ie = Nothing
End Sub
Sub Wait(ie As Variant)
Do While ie.Busy
Application.wait DateAdd("s", 1, Now)
Loop
End Sub
When a run the above Test sub on a machine with IE8, it prints two different URLs, which is the expected behavior. However, when I run the same code on a machine with IE11, it prints the first URL twice. Any idea what might be wrong?
Note: To run the above code, you have to set two variables url1 and url2. The forum post rules didn't allow me to set those.
I have some code that retrieves data from multiple websites via Internet Explorer automation in VBA. My code worked without problems with IE8, but in IE11, after the Navigate method of the Internet Explorer object is called, the Document and LocationURL are not updated; they still refer to the previously displayed website. Here's some code to reproduce the problem:
Sub Test()
Debug.Print "start"
Dim ie
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate url1
wait ie
Debug.Print "Current URL: " & ie.LocationURL
ie.Navigate url2
wait ie
Debug.Print "Current URL: " & ie.LocationURL
Set ie = Nothing
End Sub
Sub Wait(ie As Variant)
Do While ie.Busy
Application.wait DateAdd("s", 1, Now)
Loop
End Sub
When a run the above Test sub on a machine with IE8, it prints two different URLs, which is the expected behavior. However, when I run the same code on a machine with IE11, it prints the first URL twice. Any idea what might be wrong?
Note: To run the above code, you have to set two variables url1 and url2. The forum post rules didn't allow me to set those.