WebBrowser code help

Ks1102

Well-known Member
Joined
Jan 8, 2008
Messages
689
Hi All
I need help as the “WebBrowser” function that’s I really don’t know, but want to have someone help.



Example: URL: go to YAHOO below:

Private Sub CommandButton1_Click()
WebBrowser1.Navigate "http://www.yahoo.com"
End Sub


Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
“ don’t know how it here ??????????????????
End Sub
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
I will make the big assumption that you are trying to login in to your Yahoo account.

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] cmdNavigate_Click()
  WebBrowser1.Navigate ("http://yahoo.com")
[color=darkblue]End[/color] [color=darkblue]Sub[/color]



[color=darkblue]Private[/color] [color=darkblue]Sub[/color] WebBrowser1_DocumentComplete([color=darkblue]ByVal[/color] pDisp [color=darkblue]As[/color] [color=darkblue]Object[/color], URL [color=darkblue]As[/color] [color=darkblue]Variant[/color])
  [color=darkblue]If[/color] pDisp [color=darkblue]Is[/color] WebBrowser1.Application [color=darkblue]Then[/color]
    
    [color=darkblue]Do[/color]
      pDisp.Document.all.Item("login").Value = "[COLOR="Red"]Your User Name"[/COLOR]
      pDisp.Document.all.Item("passwd").Value = "[COLOR="red"]Your Password[/COLOR]"
      pDisp.Document.all.Item(".save").Click [color=green]'submit button[/color]
    
    [color=darkblue]Loop[/color] [color=darkblue]Until[/color] pDisp.ReadyState = READYSTATE_COMPLETE
  [color=darkblue]End[/color] [color=darkblue]If[/color]
  
  MsgBox "Page Loaded"
[color=darkblue]End[/color] [color=darkblue]Sub[/color]
 
Upvote 0
i will make the big assumption that you are trying to login in to your yahoo account.

Rich (BB code):
private sub cmdnavigate_click()
  webbrowser1.navigate ("http://yahoo.com")
end sub



private sub webbrowser1_documentcomplete(byval pdisp as object, url as variant)
  if pdisp is webbrowser1.application then
    
    do
      pdisp.document.all.item("login").value = "your user name"
      pdisp.document.all.item("passwd").value = "your password"
      pdisp.document.all.item(".save").click 'submit button
    
    loop until pdisp.readystate = readystate_complete
  end if
  
  msgbox "page loaded"
end sub
thats really great assumption by bertie.
 
Upvote 0

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

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