SOLVED: VBA code to maniplate web browser fails
I have some code which worked fine on one computer (Vista, Excel 2007 (in compatibility mode), IE8) but which falls apart on my main computer (Vista, Excel 2003, IE7). The code is:
I do have the Microsoft HTML Object Library set as a reference.
The problem is, the line "ie.navigate" won't use the browser window it's just created to launch the URL. If another browser window is open it uses a new tab in that, otherwise it opens a new window. Therefore my following code isn't looking at the browser window containing the webpage, so nothing works.
I don't understand why "ie.navigate" won't launch the URL in the window set to "ie". Help!!
I have some code which worked fine on one computer (Vista, Excel 2007 (in compatibility mode), IE8) but which falls apart on my main computer (Vista, Excel 2003, IE7). The code is:
Code:
Sub MySub(Usr As String)
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate ("MyURL" & Usr)
...
End Sub
The problem is, the line "ie.navigate" won't use the browser window it's just created to launch the URL. If another browser window is open it uses a new tab in that, otherwise it opens a new window. Therefore my following code isn't looking at the browser window containing the webpage, so nothing works.
I don't understand why "ie.navigate" won't launch the URL in the window set to "ie". Help!!
Last edited: