Raygar
03-13-2013, 01:30 PM
Got a scenario regarding Google Maps.
I seen many arcticles about it, but it's a bit complex and over my head. All I want to do is input destinations into the interface from a list I have which is exported to Excel.
Can't post links yet, but the site is just simply google maps.
I have the following code listed below.
Clicking on "Get Direction" isn't an issue.
Clicking on "Add Destination" isn't an issue.
Filling in Rows "A" & "B" isn't an issue, but I can't add in lines for C, D, E, F, etc.
I really don't want to resort to 'sendkeys'.
I seen references to $ID. I'm thinking that's how you do it, but how do you make use of $id?
Example:
<div class="dir-wp" jsattrs="id:'dir_wp_' + $id" id="dir_wp_template" style="display:none">
Sub GoogleMaps()
Dim FieldAddress As Object
Dim FieldAddress2 As Object
Dim FieldCoordinates As Object
Dim BtnDirections As Object
Dim BtnAddDestinations As Object
Dim BtnReset As Object
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
While ie.Busy
Application.Wait DateAdd("s", 1, Now)
Wend
ie.navigate "google maps"
While ie.Busy
Application.Wait DateAdd("s", 1, Now)
Wend
Application.Wait DateAdd("s", 1, Now)
Set BtnDirections = ie.document.getElementById("d_launch")
BtnDirections.Click
Set BtnAddDestinations = ie.document.getElementById("add_dest")
Set FieldAddress = ie.document.getElementsByName("saddr")
FieldAddress(1).Value = "Start"
Set FieldAddress2 = ie.document.getElementsByName("daddr")
FieldAddress2(1).Value = "End"
BtnAddDestinations.Click
Application.Wait DateAdd("s", 1, Now)
' saddr = start address. daddr = end address. Using array (2), (3), etc doesn't work.
End Sub
I seen many arcticles about it, but it's a bit complex and over my head. All I want to do is input destinations into the interface from a list I have which is exported to Excel.
Can't post links yet, but the site is just simply google maps.
I have the following code listed below.
Clicking on "Get Direction" isn't an issue.
Clicking on "Add Destination" isn't an issue.
Filling in Rows "A" & "B" isn't an issue, but I can't add in lines for C, D, E, F, etc.
I really don't want to resort to 'sendkeys'.
I seen references to $ID. I'm thinking that's how you do it, but how do you make use of $id?
Example:
<div class="dir-wp" jsattrs="id:'dir_wp_' + $id" id="dir_wp_template" style="display:none">
Sub GoogleMaps()
Dim FieldAddress As Object
Dim FieldAddress2 As Object
Dim FieldCoordinates As Object
Dim BtnDirections As Object
Dim BtnAddDestinations As Object
Dim BtnReset As Object
Dim ie As Object
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
While ie.Busy
Application.Wait DateAdd("s", 1, Now)
Wend
ie.navigate "google maps"
While ie.Busy
Application.Wait DateAdd("s", 1, Now)
Wend
Application.Wait DateAdd("s", 1, Now)
Set BtnDirections = ie.document.getElementById("d_launch")
BtnDirections.Click
Set BtnAddDestinations = ie.document.getElementById("add_dest")
Set FieldAddress = ie.document.getElementsByName("saddr")
FieldAddress(1).Value = "Start"
Set FieldAddress2 = ie.document.getElementsByName("daddr")
FieldAddress2(1).Value = "End"
BtnAddDestinations.Click
Application.Wait DateAdd("s", 1, Now)
' saddr = start address. daddr = end address. Using array (2), (3), etc doesn't work.
End Sub