PDA

View Full Version : question on controlling/accessing IE from excel VBA



spock41757
04-14-2011, 05:11 AM
Hi,

My company has a server that does various reports through the company intranet, which I want to automate. The sequence is to login, which takes you to the report selection page, which then takes you to the data selection page. After this, it goes to the server and plots the data in a new IE window.

I can successfully automate everything, except getting the final data. The problem seems to be that the final IE window returns the data through a server script/app without updating the URL. So when I try to access the data through the IE.document.all collection, the IE page elements aren't really accessible as the ie.ReadyState is actually in a READYSTATE_ UNINITIALIZED condition. If I use the URL in the window, and do .Navigate2 <url>, it goes to a READYSTATE_COMPLETE, but gives me the items of a previous window (but the data is still in the window).

Is there a way around this, or can it only be solved by talking to the server administrators?

Thanks,
Mike L.

Crocus Crow
06-21-2011, 04:11 PM
Try looping through Shell.Windows to find the new IE window. Or use the InternetExplorer object with WithEvents to catch the creation of the new IE window via the NewWindow2 event.