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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clicking a single button in webbrowser 1

Status
Not open for further replies.
Apr 27, 2006
126
GB
Hi,

I have embedded a "Webbrowser" in a word document. I want to perform the simplest of tasks.

on whatever action, I would like it to activate the browser, navigate to a given page and then click on a button (which I know the name of)

simple as that, no numbers to fill in, no values to send. I don't care if it's quick and dirty (other than sendkeys) but I'd just like to have it perform that action


viewing source of the page
Code:
<input type='submit' name='refreshthis' value='REFRESH'>

and the code so far, I have a feeling I should really be creating this as an object etc.. but this just seemed quicker and simpler for the task at hand

Code:
Webbrowser1.Activate
Webbrowser1.Silent = True
Webbrowser1.Navigate("[URL unfurl="true"]http://www.thesite.com/index.php?on=rejig")[/URL]

Thanks in advance

________
clueless
 
or - found this somewhere, I just can't figure out how to "click" the button...

Code:
  Dim IE As Object
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Navigate "[URL unfurl="true"]http://www.thesite.com/index.php?on=rejig"[/URL]
  IE.Visible = False
  While IE.Busy
    DoEvents
  Wend
  'IE.Document.All.SOMETHING?????

________
clueless
 
why do you need to click the button?
simply perform the "navigate" call that the button does.
i'm guessing it's in the it's in the html form declaration looking something like [tt]<form method=POST action=index.php>[/tt] where action is the url the results are posted to.
good luck.



mr s. <;)

 
ah, it's ok. Finally managed to figure it out with some experimentation, i guess I'll post the info in case of the unlikely event of someone wanting to do the same thing.

Code:
  Dim IE As Object
  Set IE = CreateObject("InternetExplorer.Application")
  IE.Navigate "[URL unfurl="true"]http://www.thesite.com/index.php?on=rejig"[/URL]
  IE.Visible = False
  While IE.Busy
    DoEvents
  Wend
  IE.Document.all("refreshthis").Click

works like a charm :)

________
clueless
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top