Help with code: Web query for security agreement


B

brianatee

Hello,

I am trying to make a web query to access a website and download
natural gas market data. I am to the point where I almost have the
code, (thanks to help on this site). Any more input would be greatly
appreciated.

I need to access https://www.services.nymex.com/otcsettlement/OTCSettle.jsp,
agree to the User agreement and click the link "Download all available
OTC settlement data" I then need to open the .csv file and copy it
into my excel sheet. I am having trouble clicking submit on the first
page Here is the code I have so far, any help???

Thanks so much!

___________________

Sub Basis_web_query()

Dim ie As Object
Dim nFile As Integer

Set ie = CreateObject("InternetExplorer.Application")


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
 
Ad

Advertisements

Ad

Advertisements

B

brianatee

That did the trick! Thanks so much!

Try:

ie.Document.getElementById("aspnetForm").submit

Tim


I am trying to make a web query to access a website and download
natural gas market data. I am to the point where I almost have the
code, (thanks to help on this site). Any more input would be greatly
appreciated.
I need to access
https://www.services.nymex.com/otcsettlement/OTCSettle.jsp,
agree to the User agreement and click the link "Download all available
OTC settlement data" I then need to open the .csv file and copy it
into my excel sheet. I am having trouble clicking submit on the first
page Here is the code I have so far, any help???
Thanks so much!

Sub Basis_web_query()
Dim ie As Object
Dim nFile As Integer
Set ie = CreateObject("InternetExplorer.Application")
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!!!]]]
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