Run-Time error '13': Type mismatch

nxbit01

New Member
Joined
Sep 27, 2017
Messages
1
Hello everyone,
I'm trying to create a macro to auto fill a form for me. There is a field called agent name. It requires one to place the agents ID, click find, and select them from a list. I am using their ID, so the "list" actually only contains one value. Even though its the only agent in the list, you must select the agent name from the list. I've included the HTML snip it of the list, and my code below

****HTML****

<ul tabindex="0" class="ui-autocomplete ui-front ui-menu ui-widget ui-widget-content" id="ui-id-1" style="left: 184.92px; top: 220px; width: 263px; display: none;"><li tabindex="-1" class="ui-menu-item" id="ui-id-3">Last Name, First Name (1234567/7654321) </li></ul>
<li tabindex="-1" class="ui-menu-item" id="ui-id-3">Last Name, First Name (1234567/7654321) </li>
</ul>

***VBCODE***

Sub TrackerAutoFill()
'Creates a Sub called TrackerAutoFill


Dim ie As Object
'set ie as an object
Set ie = CreateObject("internetexplorer.application")
'sets ie to the internet explorer applicaton
With ie
.Visible = True
.navigate "OURWEBFORMPAGE"
'opens the ie object and navigates to the tracking page


Do While .busy
DoEvents
Loop


Do While .readystate <> 4
DoEvents
Loop
'provides time for ie to open, and waits for the page to load.


Set agentname = .document.getelementbyid("txtReceivedBy")
agentname.Value = "7654321"
.document.getelementbyid("btnReceivedBy").Click


Do While .busy
DoEvents
Loop
Do While .readystate <> 4
DoEvents
Loop


Set agentselection = .document.getelementbyid("ui-id-1")
agentselection.ListIndex = agentselection.ListCount - 1






End With
End Sub
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.

Forum statistics

Threads
1,225,171
Messages
6,183,324
Members
453,155
Latest member
joncaxddd

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