?
Solved

Selecting a choice in Drop-Down Menu

Posted on 2006-04-27
7
Medium Priority
?
139 Views
Last Modified: 2010-05-01
I am using Microsoft Internet Controls. After loading a webpage in it, to fill a textbox (whoami) I am using the following code...

Private Sub WebBr_DownloadComplete()
WebBr.Document.All.whoami.Value = "vshankaa"
End Sub

It is working fine, but I want to know how to select an item from a Drop-Down Menu? Say the DDM has the name "dropmenu" and has "I am a Fool" as one of its item, how to select this item?
0
Comment
Question by:shanka
  • 4
  • 3
7 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16551649
EvtPerType.selectedIndex = 3

WebBr.Document.All.comboboxid.text = "I am a Fool"

or


WebBr.Document.All.comboboxid.selectedIndex = 3
0
 

Author Comment

by:shanka
ID: 16552152
WebBr.Document.All.comboboxid.text = "I am a Fool" is not working! As I don't know the index of the item I am not able to use the second method.
0
 
LVL 26

Accepted Solution

by:
EDDYKT earned 60 total points
ID: 16552238
may be


For i = 0 To WebBr.Document.All.comboboxid.Count
If WebBr.Document.All.comboboxid.options(i).text = "I am a Fool" Then
WebBr.Document.All.comboboxid.selectedIndex = i
End If
Next
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:shanka
ID: 16553059
The If condition part is working! But loop is not working .Count is not the right keyword.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16553679
how about


For i = 0 To WebBr.Document.All.comboboxid.options.length
0
 

Author Comment

by:shanka
ID: 16554730
This is working!!!!...

For I = 0 To WebBr.Document.All.comboboxid.Options.length
    If WebBr.Document.All.comboboxid.Options(I).Text = "I am a Fool" Then
        WebBr.Document.All.comboboxid.selectedIndex = I
        Exit Sub
    End If
Next
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 16555082
But y i only get B grade?
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question