D
Daril
I am 99% finished a little application that will automate a bunch of web
procedures at work for me. So I can basically start it up on my laptop,
and let the application do it's work. The only problem I am having is
that a combobox in the web application has an onchange() event set. Is
there anyway at all using the Microsoft Internet Controls (or any other
control set) to make the drop-down box fill with the appropriate
selection?
I have tried:
Sub SetTheDropDown()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate2 "{web address}"
[login procedure to address]
[click a link to bring me to the right screen]
DropDownName = "_cboDefaultPortfolio"
For Each Tag In ie.Document.all.tags("option")
'This loop get's the ID for the dropdown
Debug.Print Tag.innerText
If Tag.innerText = "SaveAllDocuments (portfolio)" Then
DropID = Tag.Value
Set Ipf = ie.Document.all.Item(DropName)
Ipf.Value = DropID
Exit For
End If
Next Tag
ie.quit
Set ie=nothing
End Sub
The thing is that when I do this the combobox value changes, but the
onchange() event does not fire. I tried running ie.navigate javascript()
with that code, but all it does is put a number up on my screen. Then I
was hoping Ipf.Click would open up the combobox, and then I could use
SendKeys to send a unique first key like |. Then I tried using
"SendKeys" to send the tab command to try to reach the combobox, and the
selecting from there.
If you actually click on the combobox dropdown, and make a new selection
the screen refreshes and saves the selected portfolio as the default
portfolio.
Is there any other way to interact with a selection/combobox? I could not
find anything at all using Google search, and it frustrates me to no end
that I am so close, but this one item is stopping me.
Andy
procedures at work for me. So I can basically start it up on my laptop,
and let the application do it's work. The only problem I am having is
that a combobox in the web application has an onchange() event set. Is
there anyway at all using the Microsoft Internet Controls (or any other
control set) to make the drop-down box fill with the appropriate
selection?
I have tried:
Sub SetTheDropDown()
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate2 "{web address}"
[login procedure to address]
[click a link to bring me to the right screen]
DropDownName = "_cboDefaultPortfolio"
For Each Tag In ie.Document.all.tags("option")
'This loop get's the ID for the dropdown
Debug.Print Tag.innerText
If Tag.innerText = "SaveAllDocuments (portfolio)" Then
DropID = Tag.Value
Set Ipf = ie.Document.all.Item(DropName)
Ipf.Value = DropID
Exit For
End If
Next Tag
ie.quit
Set ie=nothing
End Sub
The thing is that when I do this the combobox value changes, but the
onchange() event does not fire. I tried running ie.navigate javascript()
with that code, but all it does is put a number up on my screen. Then I
was hoping Ipf.Click would open up the combobox, and then I could use
SendKeys to send a unique first key like |. Then I tried using
"SendKeys" to send the tab command to try to reach the combobox, and the
selecting from there.
If you actually click on the combobox dropdown, and make a new selection
the screen refreshes and saves the selected portfolio as the default
portfolio.
Is there any other way to interact with a selection/combobox? I could not
find anything at all using Google search, and it frustrates me to no end
that I am so close, but this one item is stopping me.
Andy