It took me a while to get the NYC map working because I had to wait for the
basse map to finish loading before I could enter an address. I finally found
an object I could use to do this. I then submitted the address but the same
object couldn't be used again to determine when the detail location was
found. You will see that the macro finishes but the NYC map ius still
loading.
The google map was simple. Let me know if you still need help.
Sub NYCMaps()
SearchType = "Address"
AddressNumber = "50"
StreetName = "Rockefeller Plaza"
borough = "Manhattan"
Const READYSTATE_COMPLETE = 4
'create tow IE explorer applications
'first for NYC maps
'second for google maps
URL = "
http://gis.nyc.gov/doitt/nycitymap"
URL2 = "
http://maps.google.com/maps?hl=en&tab=wl"
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
Set ie2 = CreateObject("InternetExplorer.Application")
ie2.Visible = True
ie.Navigate URL
ie2.Navigate URL2
Do While ie.readystate <> 4 Or ie.busy = True Or _
ie2.readystate <> 4 Or ie2.busy = True
DoEvents
Loop
'put address into google map
Set AddressBox = _
ie2.document.getelementbyid("q_d")
findAddress = AddressNumber & " " & StreetName & _
" " & borough & " " & "NY"
AddressBox.Value = findAddress
'submit google map
Set submit = ie2.document.getelementbyid("q-sub")
submit.form.submit
'wait for NYC map to be loaded
Do
DoEvents
Set basemap = ie.document.getelementbyid("basemap")
Loop While basemap Is Nothing
Set SearchTypeBox = _
ie.document.getelementbyid("wm_widget_SimpleSelect_0")
SearchTypeBox.Value = SearchType
Set AddressNumberBox = _
ie.document.getelementbyid("dijit_form_ValidationTextBox_0")
AddressNumberBox.Value = AddressNumber
Set StreetNameBox = _
ie.document.getelementbyid("dijit_form_ComboBox_0")
StreetNameBox.Value = StreetName
Set BoroughBox = _
ie.document.getelementbyid("wm_widget_SimpleSelect_1")
BoroughBox.Value = borough
Set Findbutton = _
ie.document.getelementbyid("dijit_layout_ContentPane_5")
'submit NYC maps
Findbutton.FirstChild.Click
Do While ie.readystate <> 4 Or ie.busy = True Or _
ie2.readystate <> 4 Or ie2.busy = True
DoEvents
Loop
'wait for NYC map to be loaded
'this isn't working correctly
Do
DoEvents
Set basemap = ie.document.getelementbyid("basemap")
Loop While basemap Is Nothing
'Set ie = Nothing
'Set ie2 = Nothing
End Sub
Sub Dump(document As Variant)
With Sheets("Dump")
.Cells.ClearContents
RowCount = 1
For Each itm In document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.classname
.Range("C" & RowCount) = itm.ID
If Not IsNull(itm.onclick) Then
.Range("D" & RowCount) = True
End If
.Range("E" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub
Sub Dump2(document As Variant)
With Sheets("Dump2")
.Cells.ClearContents
RowCount = 1
For Each itm In document.all
.Range("A" & RowCount) = itm.tagname
.Range("B" & RowCount) = itm.classname
.Range("C" & RowCount) = itm.ID
If Not IsNull(itm.onclick) Then
.Range("D" & RowCount) = True
End If
.Range("E" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub