Hi Joel,
After I run the software that you help me build how can I attached (by using
code lines) the link to the specified address attached to a cell in my sheet?
"http://gis.nyc.gov/doitt/nycitymap"
"http://maps.google.com/maps?hl=en&tab=wl"
Thank you so much for any suggestion!
"Joel" wrote:
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_ValidationT extBox_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_ContentPa ne_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
"Joel" wrote:
I have this code for google maps that I did a few weeks ago that actually
extracts the distance between tow zipcodes. I think you will recoognize one
of the zip codes. I'm going to look at the NYC maps next. I will then
modify the google code to work with an address instead of zipcode. I will
work with 50 Rockefeller Center
Sub FindDistance()
Const READYSTATE_COMPLETE = 4
URL = "http://maps.google.com/maps?hl=en&tab=wl"
Set ie = CreateObject("InternetExplorer.Application")
ie.Visible = True
ie.Navigate URL
Do While ie.readyState < 4 Or ie.busy = True
DoEvents
Loop
Set StartLocation = ie.document.getelementbyid("d_d")
StartLocation.innertext = "07508"
Set EndLocation = ie.document.getelementbyid("d_daddr")
EndLocation.innertext = "10001"
Set submit = ie.document.getelementbyid("d_sub")
'submit.Select
submit.Form.submit
Do While ie.readyState < 4 Or ie.busy = True
DoEvents
Loop
Call Dump(ie.document)
Set distance = ie.document.getelementbyid("dditd")
MsgBox (distance.innertext)
Set ie = 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
.Range("D" & RowCount) = Left(itm.innertext, 1024)
RowCount = RowCount + 1
Next itm
End With
End Sub
"Dan Tabla" wrote:
Hi everyone,
I work in a mapping departament and every job I have to map I need to check
with maps.google.com and http://gis.nyc.gov/doitt/nycitymap.
I would realy appreciate if you can help me, I want to have a form where to
introduce an address that GoogleMaps and NYCITYMAP will open simultaneously.
That software will save me a lot of time.
Does anyone has an idea where I can get a free software that mangifies the
text.(Windows Magnifier loses details if you zoom 2x)
PS. I'm not alouded to install any software at work, that's why I think a
script will be more appropriate.
Thank you so much!