Using VBA to Click a Website Button

benx85

New Member
Joined
Aug 8, 2014
Messages
2
Hello Everyone

I have been scouring the web and can't find a solution that works. Here is the website that I am accessing:

RT & TMS Outrigger Pad Load Calculator

I want to click the "Accept" button. My code successfully opens IE and navigates to the page but then fails to click the button. Here is all of my code:

Code:
Sub IE()


Set objIE = CreateObject("internetexplorer.application")




'set all of the properties for the Internet Explorer Window.
objIE.Top = 0
objIE.Left = 0
objIE.Width = 1600
objIE.Height = 1000
objIE.addressbar = 0
objIE.StatusBar = 0
objIE.Toolbar = 0
objIE.Visible = True


'Navigate to the website.
objIE.navigate ("http://www.manitowoccranes.com/en/Resources/tools/Outrigger-Pad-Load-Calculators/RT-TMS")


Do
DoEvents
Loop Until objIE.readystate = 4

'everything works until this point:


objIE.document.GetElementByID("ctl00_placeHolderMain_btnAccept").Click




Do
DoEvents
Loop Until objIE.readystate = 4


MsgBox "Complete!"



End Sub

Here is the website code for the "Accept" button:

input type="submit" name="ctl00$placeHolderMain$btnAccept" value="Accept" id="ctl00_placeHolderMain_btnAccept"

Thanks!
Ben
]
 
Last edited:
Ben

Does this work?
Code:
objIE.document.forms(0).submit

Mepwnz2010

Are you working with the same web page/site?

If you aren't then I'm pretty sure it's not quite the same thing.:)

Can you post the URL of the site you are working with and/or start a new thread?
 
Upvote 0
@Mepwnz2010: Nope - There is quite out there that is written to do a similar operation but I haven't figure it out yet for this website. I am thinking that it has something to do with the forms and writing VBA to get inside that form. Does your webpage have a similar form?

@Norie: I was hoping that you would respond... In my research I ran across quite a few of your posts on writing VBA for websites. I tried that code and it refreshes the browser page. No error though.
 
Last edited:
Upvote 0

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