ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   send keystrokes to whereis.com.au - get directions (https://www.excelbanter.com/excel-programming/377698-send-keystrokes-whereis-com-au-get-directions.html)

chrisho

send keystrokes to whereis.com.au - get directions
 
I managed to use Excel VB to open www.whereis.com.au web site and go to the
get directions web site. However, I have trouble to send key strokes to the
field. here is my macro.

Sub getdirection()

'log onto the www.whereis.com.au web site

Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate
"http://www.whereis.com/whereis/home.do;jsessionid=31763A8054B6B4158122BB6F9995530 3.server3-1"

Do While ie.Busy And Not ie.ReadyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

ie.Document.all("whereisAddress.streetNumber").Val ue = "65"
ie.Document.all("whereisAddress.fullStreetName").V alue = "Waterloo Road"
ie.Document.all("whereisAddress.suburb").Value = "Mosman"
ie.Document.all("whereisAddress.state").Value = "NSW"


Set ipf = ie.Document.all.Item("cmd")
ipf.Click





End Sub


PapaDos

send keystrokes to whereis.com.au - get directions
 
Use the ID instead of the name of the elements, it is a lot easier:

ie.document.getElementById("addressStreetNo1").val ue = "65"

--
Regards,
Luc.

"Festina Lente"


"chrisho" wrote:

I managed to use Excel VB to open www.whereis.com.au web site and go to the
get directions web site. However, I have trouble to send key strokes to the
field. here is my macro.

Sub getdirection()

'log onto the www.whereis.com.au web site

Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.navigate
"http://www.whereis.com/whereis/home.do;jsessionid=31763A8054B6B4158122BB6F9995530 3.server3-1"

Do While ie.Busy And Not ie.ReadyState = 4:
Application.Wait (Now + TimeValue("0:00:02"))
DoEvents
Loop

ie.Document.all("whereisAddress.streetNumber").Val ue = "65"
ie.Document.all("whereisAddress.fullStreetName").V alue = "Waterloo Road"
ie.Document.all("whereisAddress.suburb").Value = "Mosman"
ie.Document.all("whereisAddress.state").Value = "NSW"


Set ipf = ie.Document.all.Item("cmd")
ipf.Click





End Sub



All times are GMT +1. The time now is 01:54 AM.

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