Using Macros on the Web?

  • Thread starter Thread starter Graham
  • Start date Start date
G

Graham

I have a series of numbers that I want to individually populate into an
internet explorer application so I can run a search. How can I make a macro
do this?

Thanks,
Graham
 
Hi Graham,

You will need the property ID of the form elements on the webpage,
which you can generally get by viewing Page Source. The following code
is something I use to look up Postal Codes from an Excel addressbook.


Sub PostalLookup()
Dim ie As Object
Dim Rng As String

Rng = ActiveCell.Value
' Prepare to open the web page
Set ie = CreateObject("InternetExplorer.Application")
With ie
.Visible = True
.navigate "http://www.canadapost.ca/Personal/Tools/Pcl/
Range.aspx"
' Loop until the page is fully loaded
10 Do Until Not .Busy
DoEvents
Loop
' Make the desired selections on the web page and click the submit
Button
On Error GoTo 10
Set ipf = ie.document.all.Item("postal_code") 'Selects the
field to enter in the postal code
ipf.Value = Rng 'Enters the postal code from the
ActiveCell into the form
Set ipf = ie.document.all.Item
("ctl00_ctl00_ctl00_ctl00_SegmentContent_MainContent_PersonalContent_PclContent_Submit")
'Selects the submit button
ipf.Click

Do Until Not .Busy
DoEvents
Loop
End With
End Sub


HTH,

Steven
 
I have a series of numbers that I want to individually populate into an
internet explorer application so I can run a search. How can I make a macro
do this?

Thanks,
Graham

Whats the url?..Ron
 
Back
Top