Excel Error 438 Object Doesn't Support property or Method

kdenney

Board Regular
Joined
Apr 26, 2010
Messages
103
I am trying to use the below code to go a specific website and cause a
dropdown to fire. But it is giving a error 438 object doesnt support this property or method at the With appIE.document.frmNavigation spot in the code. Any suggestions?


Sub PropInfo()
Dim appIE As SHDocVw.InternetExplorer
Set appIE = New SHDocVw.InternetExplorer
'Set appIE = CreateObject("INTERNETEXPLORER.APPLICATION")
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").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 .submit
End With
End Sub
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Your code works fine for me.

Opens the webpage
Selects "address" in search by
the onchange displays the address search.

Have you the correct reference? I used "Microsoft internet controls"
 
Upvote 0
Also,

it may work for this website but the site I am using has a postback and is an intranet site. So if someone could teach me how to use this code and manipulate it to work on a postback procedure it would be awesome!
 
Upvote 0
I have Microsoft Internet Controls referenced and Microsoft HTML Object Library as well. Is there another one that I am missing?
 
Upvote 0
Right it works fine for this particular website but it doesn't work if the website has a postback in the html... can we tweak it? I guess that might work.
 
Upvote 0
I take it there's no way you can post a URL for the intranet site?

Without that it's kind of hard to help with this sort of thing.

Every page is designed differently and it's quite hard to generalise about this sort of thing.

Looking at the code I think the problem is that there is no object called frmNavigation on the 'real' page you want to use this code on.

If you can take a look at the source code of the page and in particular look out for any id attributes.

With an id you can use GetElementByID to create a reference to a control/form/anything really on the page - if it's got an idea of course.

The following code creates references for the document, form and dropdown.

It then picks the 2 item ('Address', index 1) from the dropdown and triggers it's onchange event.

Rich (BB code):
Option Explicit
 
Sub PropInfo()
Dim appIE As Object
Dim doc As Object
Dim frmNav As Object
Dim ddTool As Object
Dim btnSubmit As Object
 
    Set appIE = CreateObject("INTERNETEXPLORER.APPLICATION")
 
    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
 
    Set doc = appIE.document
 
    Set frmNav = doc.getelementbyid("frmnavigation")
 
    Set ddTool = doc.getelementbyid("bytool")
 
    ddTool.selectedindex = 1
 
    ddTool.onchange
 
    Set appIE = Nothing
 
End Sub
If you take a look at the source of the actual page you are interested in perhaps this will give you some pointers.

By the way I don't know how but this worked even though there weren't any id attributes for the form etc, GetElementByID seemed to work
with the names.:eek:

PS No references required.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,225,549
Messages
6,185,585
Members
453,307
Latest member
addydata

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top