View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams[_2_] Tim Williams[_2_] is offline
external usenet poster
 
Posts: 298
Default (possibly) simple question about web controls

HTML select elements (listboxes) have a collection of "option" child
elements.
You would select an option by setting its 'selected' attribute to true after
checking its "value".


With .document.all("fourthcriteriafield")
For Each opt In .Options
If opt.Value = "41" Or opt.Value = "177" Then
opt.Selected = True
Else
opt.Selected = False
End If
Next opt
End With


Tim



"KBL" wrote in message
...
please pardon my newbishness... this is probably just something extremely
simple, but i've had NO luck finding out how to do this...

i've written code basically to have excel log into a website i use for my
job and do this and that... but the part where i'm getting stumped is when
i
have excel use the code:



With appIE
sURL = "https://www.thewebsiteimaccessing.com/thereportineed"
.Navigate sURL
call ReadyWait 'waits for page to load
.Document.all("firstcriteriafield ").Value = "12"
.Document.all("secondcriteriafield").Value = "26"
.Document.all("thirdcriteriafield").Value = "8"

'******************
'Here is where I need the correct code to have
'it select multiple options from the criteria listbox
'******************

With .Document.all("fourthcriteriafield")
.Value = "41"
.Value = "177"
.value = "178"
End With

.Document.all("btnRetrieve").Click

End With



if i've not managed to make my request clear... basically, i'm trying to
find the code that will mimic ctrl+click in a multi-select listbox.

any help?





--
Oh, the creative possibilities! ^_^