Thread
:
Opening an IE window from another IE window
View Single Post
#
2
Posted to microsoft.public.excel.programming
Paul Lautman
external usenet poster
Posts: 85
Opening an IE window from another IE window
wrote:
Hello,
I am trying to write some code in order to download data off the
internet. It involves going to a website, running a query, exporting
the query to a .csv file, and downloading the file. I am experiencing
a problem when trying to export the query.
When doing it manually, after the query is run, you can select an
"Export" option from a drop down menu. Selecting that causes a new IE
window to open and it asks if you would like to export as a .csv or a
.pdf. You make your choice, and you click Submit.
There is a specific web address you can enter to bring up the prompt
that asks you if you want to export as a .csv or .pdf. The only
problem is, if you just have an IE window navigate to that address,
it does not link that site to a query. It just opens the web address
as is. So I want the code to behave just as doing it manually would,
meaning, I want a new IE window to open from the original IE window.
My code:
*****
Sub getOutages()
Dim IE As Object, url As String, url2 As String, url3 As String,
url4 As String, url5 As String
Dim IE2 As Object
Set IE = CreateObject("internetexplorer.application")
'''This is the url of the website.
url = "http://www.... com"
'''This is the url that shows the results of the query.
url2 = "http://www.... com"
'''This is the url that shows the prompt for exporting as .csv or
.pdf.
url3 = "http://www.... com"
Set IE2 = CreateObject("internetexplorer.application")
With IE
.Visible = True
.navigate url (opens the website)
.navigate url2 (runs the query)
IE2.visible = True
.navigate url3
''' Somehow I would like url to be navigated from IE but
for it to be opened in IE2.
End With
End Sub
*****
Any help on this would be greatly appreciated! Thanks!!!!
- Keith
Why worry about the csv. Why not just create an Excel web query and get the
data from url2?
Reply With Quote
Paul Lautman
View Public Profile
Find all posts by Paul Lautman