Excel macro for automated web form filling

ztrackL

New Member
Joined
Aug 28, 2014
Messages
3
Hello Everyone, I posted this thread yesterday but I cant seem to find it anymore under the excel questions forums. I have a slight dilemma I was hoping someone can help me with. I work for a company that does a lot of boiler work for well over 150 locations. We keep track of parking tickets accumulated by our drivers/mechanics on an excel spreadsheet, with over 30+ drivers, driving around NYC the tickets stack up quickly. I've spent the last couple of days trying to come up with a macro that would automatically navigate to PVO Search and fill in the "License Plate" field and select PASSENGER or COMMERCIAL vehicle (pre-determined by me in the macro) and hit the search button. I'm not super experienced with excel so my knowledge is somewhat limited. If anyone could be of assistance it would be greatly appreciated! Thank you and have a nice day. Here's how far I was able to get lol: Private Sub CommandButton1_Click()
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.navigate ("PVO Search" & ActiveCell)
Do
If IE.readyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
IE.Document.Forms(0).all("Plate Number").Value = "NumberHere"
IE.Document.Forms(0).submit
End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">
Code:
IE.Document.getElementById([COLOR=#800000]"Need to locate name"[/COLOR]).selectedIndex = [COLOR=#800000]"1"

[/COLOR]
Code:
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: initial; background-repeat: initial;">IE.Document.getElementById("Need to locate name").Value = "plate Number"


</code>
Need to locate the id names off the source code of the website. With Chrome and Firefox can easily right click and chose inspect ID .</code>
 
Upvote 0
Thank you so much tyger for responding. There is no Id name, its an element and all the information the source code gives me is the element name, but when I try getElementByName it gives me the error "Object doesn't support this property or method". Here is the source code for the element:
Code:
input name="searchplate" value="" class="kioskTextStyle" size="20" maxlength="11" onkeypress="javascript:checkEnter(event)" onkeyup="javascript:updateButtonWithOneTxtbox(this, document.PlateSearch,'NYCServ_images/Search_button.gif','NYCServ_images/Search_button_grey.gif')" type="text"
and here is what I am trying: Private Sub CommandButton1_Click()
Set IE = CreateObject("InternetExplorer.application")
IE.Visible = True
IE.navigate ("PVO Search" & ActiveCell)
Do
If IE.readyState = 4 Then
IE.Visible = False
Exit Do
Else
DoEvents
End If
Loop
IE.Document.getElementByName ("searchplate").selectedIndex = "1"
IE.Document.getElementByName ("searchplate").Value = "GGW2936"
IE.Document.Forms(0).submit
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,213,564
Messages
6,114,334
Members
448,567
Latest member
Kuldeep90

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