Using Excel VBA to Submit a Web Form

Necessity

New Member
Joined
Mar 26, 2009
Messages
3
I'm struggling with submission of a web form.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
The goal: to summarize the next earnings date of a list of companies based upon their ticker symbols which reside in a column of my spreadsheet. Eventually I'll loop this code across several tickers, but for now I'm working on one coded symbol.
<o:p></o:p>
The problem: It appears that the host page does not allow the use of .submit as I get an error from Briefings.com which states "Request Not Allowed (405-HTTP verb used to access this page is not allowed)"
<o:p></o:p>
<o:p></o:p>
Here's a copy of my current macro.
<o:p></o:p>
Rich (BB code):
Sub earnings_date_finder() 
dim ie as object
dim ticker as string
dim chartpage as string
<o:p></o:p>
ticker = "ESI"
chartpage = "http://www.briefing.com/Investor/Private/Calendars/EarningsGuidanceCalendar.htm"
<o:p></o:p>
Set ie = CreateObject("internetexplorer.Application")
With ie
  .Visible = True
  .navigate chartpage
  Do While .Busy: DoEvents: Loop
  Do While .ReadyState <> 4: DoEvents: Loop
 
   .document.forms(0).Item(1).Value = ticker
   .document.forms(0).submit
  Do While .Busy: DoEvents: Loop
  Do While .ReadyState <> 4: DoEvents: Loop
<o:p></o:p>
'here is where I would manipulate the .document.body.innertext to extract info from the page . . . if it loads without error.
<o:p></o:p>
End With
Set ie = Nothing
End Sub
<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
I've struggled with this macro for a couple of days now. I've tried entering the info using Sendkeys rather than the Item(1) definition and .Submit but to no avail. Seems like it'd be a simple macro, but I'm just not getting it. I've also tried manipulating .document.forms(1). However, forms(1) generates a pop-up-window (a second instance of Internet Explorer) which I cannot seem to access within my code which has access to the initial IE window and not the newly generated one.
<o:p></o:p>
Any help would be greatly appreciated. I'm even proposing to immortalize the one who solves this by naming my subroutine after you . . . sub your_name_here().

Thanks,
Necessity
<o:p></o:p>
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
It works with:

chartpage = "http://www.briefing.com/GeneralContent/Active/Investor/TickerSearch/TickerSearchInvestor.aspx"

The HTTP 405 response occurs because the form submit (onsubmit="GetFormAction(this)) changes the form's action URL to the above page, which is different from your start page.
 
Upvote 0
Thanks very much. The simple substition of the page address fixed the issue.

My routine is now called John_W()

:)

Necessity
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,551
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top