Sub GetListItem(ItemName As String)
    dim i as long ' Need to i declared to get rid of the error message you 
have
    dim e as object ' Same with this one (I probably have the incorrect 
variable type as I don't work with web)
    Set e = Web.Selected ' This makes "e" associated to the select box
    For i = 0 To e.options.length ' count from 0 to the number of options 
within your select box (this is just in case stuff changes)
        OptName = e.options(i).innerHTML ' What's the option name
        If ItemName = e.options(i).innerHTML Then ' If ItemName is the 
same as the current option then goto the next statement
            e.selectedindex = i ' Force the Current option (i) to be 
selected
            Exit Sub ' Exit out of this procedure
        End If ' End the IF statement
    Next ' Continue Counting
End Sub ' End the Procedure
...................................
Brian Van Grinsven
Integrated Systems Specialist
Medbuy Corporation
mailto:[EMAIL PROTECTED]
http://www.medbuy.ca
T: 519.652.1688 ext. 114
F: 519.652.2788

Technical Support:
ext. 199 or [EMAIL PROTECTED]

Building Partnerships in Healthcare



"Bennett, Brian" <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
07/06/2007 11:46 AM
Please respond to
[email protected]


To
"'[email protected]'" <[email protected]>
cc

Subject
[Talk] Drop Down Code






Since I am not a programmer and each new script or task is a new adventure 
in misery is there anyone who can explain this code in layman terms?
 
Sub GetListItem(ItemName As String)
    Set e = Web.Selected
    For i = 0 To e.options.length
        OptName = e.options(i).innerHTML
        If ItemName = e.options(i).innerHTML Then
            e.selectedindex = i
            Exit Sub
        End If
    Next
End Sub

This is the code example from the HTML dropdown question in V. talk 
archives.  I've got the first part working but get an object not defined 
error at "Set e=" and also fail at "For i="  I'm guessing that For i = 0 
to e.options.length would read For i = 0 to 6, Since that is the number of 
choices on the dropdown I am working with?
 
Thanks.
 
Brian Bennett 
Systems Analyst 
Affinity Health Systems 
Clinic Billing 
628-9055 
[EMAIL PROTECTED] 
 


**********************************************************************
This e-mail and any attachments may contain confidential and 
privileged information. If you are not the intended recipient, please 
notify the sender immediately by return e-mail, delete this e-mail and 
destroy any copies. Any dissemination or use of this information by a 
person other than the intended recipient is unauthorized and may be 
illegal.
**********************************************************************

Reply via email to