Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to click a button using VBA inside HTA page.

Status
Not open for further replies.

tommytx

Programmer
Nov 27, 2002
28
0
0
US
I have tried everything I can think of to click the button anyone haveing any other ideas would be greatly appreciated.
I have sent the entire code in the attachment. Just run it and click the Craig MLS button and it will fill the user name and password box but will not click the button.

The button is focused so even the sendkey "~" for enter would do it but I cannot figrue out how to use sendkeys inside an HTA page... send keys will press the button by sending an ENTER, but the send keys code won't work inside the HTA page... any idea how to use Sendkeys inside HTA would be great..
 
[1] First you add a true (though, synthetic) sleep for the loop while .busy (or preferrable .readystate<>4).
[tt]
While objIEA.Busy
createobject("wscript.shell").run "%comspec% /c ping -n 2 127.0.0.1>nul",1,1 'sleep 1 sec
Wend
[/tt]
[2] The form submission does not need to mimic a physical click. Just use form's submit() method.
[tt]
[red]'[/red]document.forms(0).click()
objIEF.submit
[/tt]
 
amendment
[1.1] I meant this for the corresponding line, to make thing cleaner.
[tt] createobject("wscript.shell").run "%comspec% /c ping -n 2 127.0.0.1>nul",[red]0[/red],1 'sleep 1 sec[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top