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

Webbrowser control

Status
Not open for further replies.

WebStar

Programmer
May 1, 2002
69
DE
Hi I have a problem with a combobox on a page. I use Webbrowser control to navigate to a page and there I have to fill some fields.
I use:
Code:
Dim doc As HTMLDocument
Dim elem As HTMLInputElement
Dim frm As HTMLFormElement
Set doc = wbIE.Document
Set frm = doc.Forms(0)

'set username
Set elem = frm.Item("username")
elem.Value = txtField(0).Text

But on that page I have combobox also defined like this:

Code:
<SELECT SIZE=1 NAME=trait>
<OPTION VALUE=1>Option1
<OPTION VALUE=2>Option2
<OPTION VALUE=3>Option3
<OPTION VALUE=4>Option4
<OPTION VALUE=5>Option5
</SELECT>

How can I set wich option to be chosen because if I use:
Code:
Set elem = frm.Item("trait")
elem.Value = "Option1"
or
Code:
Set elem = frm.Item("trait")
elem.Value = 1
I get the error "Object doesn't support this property or method"

If it's true that we are here to help others, then what exactly are the others here for?
 
Try:

elem.item.selectedindex = x

where x is the index for the item.

Hope this helps

BB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top