Change Web Page Drop-Down To Fire Code

E

eric_powell

CROSSPOST
http://www.ozgrid.com/forum/showthread.php?t=91246

Hello, I'm using XP, MSO2003 & IE6.
My question centers around controlling internet explorer through VBA code
written in an excel workbook.
I am trying to query an online database and retrieve a value to use in a
much larger excel program. The website is given below.
http://gisims2.miamidade.gov/MyHome/proptext.asp
I am running into difficulties because the website contains a dropdown box
("Search by") which changes the form fields (found below the dropdown) based
on its selection. Unfortunately, while I am able to set the value of this
dropdown, that is not sufficient to "fire" the event operation responsible
for controlling the available fields.

I hope to remedy this by making the dropdown the "active" object and then
changing the value. (I have tried to simulate this operation by tabbing
through the webpage till I reached the dropdown and then changing the value.
That worked.)

I have attempted this using the line below. While it does not crash, it
doesn't appear to do anything either.
VB: AutoLinked keywords will cause extra spaces before keywords. Extra
spacing is NOT transferred when copy/pasting, but IS if the keyword uses
"quotes".

..Item("bytool").setActive

Same story with:
VB: AutoLinked keywords will cause extra spaces before keywords. Extra
spacing is NOT transferred when copy/pasting, but IS if the keyword uses
"quotes".

..Item("bytool").Focus

VB: AutoLinked keywords will cause extra spaces before keywords. Extra
spacing is NOT transferred when copy/pasting, but IS if the keyword uses
"quotes".

Sub PropInfo()
Dim appIE As SHDocVw.InternetExplorer
Set appIE = New SHDocVw.InternetExplorer
appIE.Visible = True
appIE.navigate "http://gisims2.miamidade.gov/MyHome/proptext.asp"
Do While appIE.Busy: DoEvents: Loop
Do While appIE.readyState <> 4: DoEvents: Loop
With appIE.document.frmNavigation
..Item("bytool").setActive
..Item("bytool").Value = "ADDR" 'Search by' dropdown
..Item("stnum").Value = "2417" 'house #' field
..Item("stdir").Value = ""
..Item("stname").Value = "ponce de leon" 'street name' field
..Item("sttype").Value = "BLVD" 'street type' field
..submit
End With
End Sub

I would greatly appreciate anyone's help with this.
 
T

Tim Williams

Try:

With appIE.document.frmNavigation
.Item("bytool").Value = "ADDR" 'Search by' dropdown
' .Item("bytool").selectedIndex = 1 'an alternative to setting the value
directly
.Item("bytool").onchange 'should fire the event handler on the select
'etc

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top