ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using Macros on the Web? (https://www.excelbanter.com/excel-programming/431700-using-macros-web.html)

Graham

Using Macros on the Web?
 
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

Steven B

Using Macros on the Web?
 
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_MainConte nt_PersonalContent_PclContent_Submit")
'Selects the submit button
ipf.Click

Do Until Not .Busy
DoEvents
Loop
End With
End Sub


HTH,

Steven

ron

Using Macros on the Web?
 
On Jul 28, 3:22*pm, Graham wrote:
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


All times are GMT +1. The time now is 08:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com