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!

Problem using webbrowser1 control (but works with DOM)

Status
Not open for further replies.

silenttalk

Technical User
Oct 30, 2002
15
GB
Hi hope someone can help me out here, I guess this is an easy correction to my code or it is not possible....

I have a fair bit of vbscript attached to an outlook custom contact form, I have a button that when clicked allows the IE DOM to navigate to a website and login, I am trying to achive the same with a webbrowser control embeded on the outlook form it navigates to the correct urls but does not populate the three fields and fails with the error code: -

Object required: WebBrowser1.document.All.Item(...)'

The code that works with the DOM is: -

Sub cmdvsp_click

Dim waitcount
Set IE = CreateObject("InternetExplorer.Application")
ie.Navigate "myURL"
IE.Visible = True
for waitcount = 1 to 13000000
next
IE.Document.All.Item("vendorname").Value = "myVendorname"
IE.Document.All.Item("username").Value = "myUsername"
IE.Document.All.Item("password").Value = "myPassword"

End Sub

The code that does not work with the WebBrowser control is: -


Sub cmdvsp_click

Dim waitcount
frame12.visible = false : frame13.visible = false : frame36.visible = false : frame29.visible = false : image1.visible = false
fullnamebutton.visible = false : phone1.visible = false : image2.visible = false : Phone1Label.visible = false
fullname.visible = false : phone1button.visible = false : WebBrowser1.visible = true : cmdback.visible = true
WebBrowser1.Navigate("myURL")
for waitcount = 1 to 13000000
next
WebBrowser1.document.All.Item("vendorname").Value = "myVendorname"
WebBrowser1.document.All.Item("username").Value = "myUsername"
WebBrowser1.document.All.Item("password").Value = "myPassword"

End Sub

All the controls are Dimensioned and set outside this Sub ie: -


Dim objControls
Set objControls = Item.GetInspector.ModifiedFormPages("General").Controls
Dim IE, WebBrowser1
Set WebBrowser1 = objControls("WebBrowser1")



any help would be extremely well received


Thanks

Silenttalk
 

Warning If the document object type is not marked safe for scripting, this property returns Nothing. For more information, see Safe Initialization and Scripting for ActiveX Controls.

is WebBrowser.Document Null?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top