Gettingbetter
Well-known Member
- Joined
- Oct 12, 2004
- Messages
- 602
Hi Everyone.
I was looking for an answer to this all day Friday without any luck. So I thought I would ask on here to see if anyone knows how to do it.
There are a lot of people asking this question (when I google it) but no one has a solution, so it might not be possible.
I am linking to a webpage in VBA using the web browser control. I login with a username and password (all works fine), scrape a couple of tables off the page (all works fine) I then have to click a button to get a CSV file.
I have looped through the webpage and found the item I need to click the button the problem is that it comes up with the box, Do you want to open or save this file? with the options, Open, Save, Cancel.
What I would like is to programticaly choose a file location and save the CSV file there. So that the user does not need to do anything.
The problem is that I can not use the API call
Private Declare Function URLDownloadToFile _
Lib "urlmon.dll" Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal lpfnCB As Long) As Long
Because the URL of the CSV is never given to me (its not in the source of the web page anywhere) and because of the nature of the web page I need to use the webBrowser control as there are alot of links (that change constantly) that I need to click to get to the download section.
I cant provide deatils of the webpage as its all secure, but the line line of code that clicks the button is
WebBrowser1.Document.forms(37).Item(10).Click
Has anyone any idea how to skip the 'Do you want to open or save this file?' box????? When you dont have the URL of the file???
Cheers
GB
I was looking for an answer to this all day Friday without any luck. So I thought I would ask on here to see if anyone knows how to do it.
There are a lot of people asking this question (when I google it) but no one has a solution, so it might not be possible.
I am linking to a webpage in VBA using the web browser control. I login with a username and password (all works fine), scrape a couple of tables off the page (all works fine) I then have to click a button to get a CSV file.
I have looped through the webpage and found the item I need to click the button the problem is that it comes up with the box, Do you want to open or save this file? with the options, Open, Save, Cancel.
What I would like is to programticaly choose a file location and save the CSV file there. So that the user does not need to do anything.
The problem is that I can not use the API call
Private Declare Function URLDownloadToFile _
Lib "urlmon.dll" Alias "URLDownloadToFileA" ( _
ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal lpfnCB As Long) As Long
Because the URL of the CSV is never given to me (its not in the source of the web page anywhere) and because of the nature of the web page I need to use the webBrowser control as there are alot of links (that change constantly) that I need to click to get to the download section.
I cant provide deatils of the webpage as its all secure, but the line line of code that clicks the button is
WebBrowser1.Document.forms(37).Item(10).Click
Has anyone any idea how to skip the 'Do you want to open or save this file?' box????? When you dont have the URL of the file???
Cheers
GB