Vba detect webbrowser button click

JudahRaion

New Member
Joined
Oct 13, 2011
Messages
20
Hi,

I'm trying to figure how to fire an event related with a specific button pressed in an userform webbrowser.

For example, I'm trying to click in "Write" button of gmail and detect it with excel.

I know that the button have the ID: ":4s"

And what I tried was:


Code:
Private Sub UserForm_Initialize()        
    TextBox1.Value = "gmail.com"
          
    Me.WebBrowser1.Navigate TextBox1.Value
    
End Sub


Private Sub WebBrowser1_DocumentCompleted()
  
    If WebBrowser1.Document.All(":4s").******* = True Then 
[COLOR=#ff0000]        Me.WebBrowser1.Navigate "about:blank" -> just to test if it is detecting my click and is not![/COLOR]
    End If


End Sub

Can anybody help me please?

Thank you
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
This is not a trivial thing to do. Once you are in the webbrowser, then Windows will not send any events ( keystrokes or mouseclicks) to Excel. These are intercepted by the current application and removed from the queu. So you would have to write a 'hook' into the Windows event queu to pick up the events and check these before passing them on. VBA? no... If you know a good C programmer he could do it, but then you're still faced with a lot of hurdles. So basically you need to rethink what you want to achieve.
 
Upvote 0
Possibly slightly related. But sending events to other applications is easier then intercepting events.
The issue in the other thread is interesting. I am assuming yahoo is using java or similar to call data and display it when you press the button. I've never worked with query tables though. So no help from me on that one. I'll see if i can dig up some code on the event intercept that might come in handy.
 
Upvote 0
Thanks. It will be much welcomed if you find something.

Eventually hope to figure out how to click that button by not using IE (perhaps using one of the two examples there).

But then might be problems to not know if the website data has completed updating from that click, before the response is generated to be sent back to Excel.
 
Upvote 0

Forum statistics

Threads
1,216,085
Messages
6,128,732
Members
449,465
Latest member
TAKLAM

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