Automate Excel download of csv file without proper URL?

B

briana.kobor

I am looking for a way to automate downloading natural gas market data
that is available here:

https://www.services.nymex.com/otcsettlement/OTCSettle.jsp

The Usage agreement must be agreed to and then the link "Download all
available OTC settlement data" must be clicked prompting a CSV
download. I then need to copy this all into an excel sheet and can
take it from there.

Note: the link that prompts the download doesn't have a URL but is
"javascript:__doPostBack('ctl00$btnExport','')"

Is there a way to do this with web query?

Help is much appreciated. Thanks.
 
T

The Dude

Hello,
The following is unfortunately incomplete as I can't seem to find the
appropriate command to click the submit image, or submit the form/page. Hope
someone will help on that.

---------------------------------------------------
Sub download_csv()
Dim IE As New InternetExplorer, web_item, a, x

IE.Visible = True
IE.Navigate "https://www.services.nymex.com/otcsettlement/OTCSettle.jsp"
Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'Agrees with the Disclaimer form
If IE.LocationURL Like "*disclaimer*" Then
'Selects 'I agree'
IE.Document.Links(4).Click

'submits the form
!!!!!! PROBLEM HERE !!!!!!

End If

Do Until IE.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop

'clicks on "Download all available..."
IE.Document.all.Item("ctl00_btnExport").Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top