VBA interacting with new IE window

Ice223

Active Member
Joined
Jun 18, 2004
Messages
334
I'm using the code below to open up ie and navigate to a website. However, when I navigate around to get to the data I need, a new window pops up with the results that I need to retrieve. How do I set the focus to the new window so I can interact with that?

Thanks.
Code:
Sub Update()
Set Ie = CreateObject("InternetExplorer.Application")
With Ie
.Visible = True
.Navigate "http://..."
Do Until .ReadyState = 4: DoEvents: Loop
Do While .Busy: DoEvents: Loop

.Navigate "javascript:doExport('exportdlg')"

'a new window has now popped up.
'need code here to work with it.

end sub
 
Tom

I've only just noticed this thread but could this perhaps be a job for the FindWindow function from the Windows API?
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi Norie... Thought of that. If you look at the arguments that are passed in the function...

Private Function GetInstance(TimeOutInSeconds As Double, Optional URL As String, _
Optional LocationName As String, Optional WindowTitle As String, _
Optional Hwnd As Long) As InternetExplorer

WindowTitle and Hwnd would be used in secondary searches performed within the function if you are not able to determine the LocationURL. I only coded it for the location URL which would be sutiable the vast majority of the time. The code works as is. The OP just needs to spend a bit more time applying it. Thanks for the input.
 
Upvote 0
Tom

Like I said just noticed the thread, haven't had time to digest and test everything that's been posted.:)

When I get a chance I'll do that, and perhaps post back though it looks like you've got things covered.

PS Totally agree about the URL thing - how can we test/troubleshoot without something to work with.:o
 
Upvote 0

Forum statistics

Threads
1,224,799
Messages
6,181,040
Members
453,014
Latest member
Chris258

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top