Hello All,
I recently found this code, which is to say the least, awesome!
What i desire is to call this code from one of my userforms that holds 4 images and show 4 views (90 degree differences) of the location.
but i cant find the right syntax to amend this line
to do what i am looking for, i have tried multiple versions of
and editing the called sub to
but i just don't understand how the image is being handled, and how to get it into my userform images, can anyone help?
Thankyou!
EDIT: Source http://stackoverflow.com/questions/33573556/embed-a-google-street-view-image-into-excel
I recently found this code, which is to say the least, awesome!
Code:
Sub GoogleStaticStreetView(oShape As Shape, _ sAddress As String, _
lHeading As Long, _
Optional lHeight As Long = 512, _
Optional lWidth As Long = 512)
'https://developers.google.com/maps/documentation/streetview/
Dim sURL As String
Dim sMapsURL As String
Dim bRunMode As Boolean
On Error GoTo RETURN_FALSE
If bRunMode Then On Error Resume Next 'Error if quota exceeded
If Len(sAddress) > 0 Then
'URL-Escaped addresses
sAddress = Replace(sAddress, " ", "+")
Else
Exit Sub
End If
sURL = _
"http://maps.googleapis.com/maps/api/streetview?" & _
"&location=" & sAddress & _
"&size=" & lWidth & "x" & lHeight & _
"&heading=" & lHeading & _
"&sensor=false"
sMapsURL = "http://maps.google.com/maps?q=" & _
sAddress & "&t=m&layer=c&panoid=0" & _
"&cbp=12," & lHeading & ",,0,4.18"
oShape.Fill.UserPicture sURL
oShape.AlternativeText = sMapsURL
Exit Sub
RETURN_FALSE:
End Sub
Sub GoogleStaticMap(oShape As Shape, _
sAddress As String, _
Optional sMapType As String = "roadmap", _
Optional lZoom As Long = 12, _
Optional lHeight As Long = 512, _
Optional lWidth As Long = 512)
'https://developers.google.com/maps/documentation/staticmaps/
Dim sURL As String
Dim sMapsURL As String
Dim sMapTypeURL As String
On Error GoTo RETURN_FALSE
' Google Maps Parameters '&t=m' = roadmap, '&t=k' = satellite
sMapTypeURL = "m"
If sMapType = "satellite" Then
sMapTypeURL = "k"
End If
If bRunMode Then On Error Resume Next 'Error if quota exceeded
If Len(sAddress) > 0 Then
'URL-Escaped addresses
sAddress = Replace(sAddress, " ", "+")
Else
Exit Sub
End If
sURL = _
"http://maps.googleapis.com/maps/api/staticmap?center=" & _
sAddress & "," & _
"&maptype=" & sMapType & _
"&markers=color:green%7Clabel:%7C" & sAddress & _
"&zoom=" & lZoom & _
"&size=" & lWidth & "x" & lHeight & _
"&sensor=false" & _
"&scale=1"
sMapsURL = "http://maps.google.com/maps?q=" & _
sAddress & _
"&z=" & lZoom & _
"&t=" & sMapTypeURL
oShape.Fill.UserPicture sURL
oShape.AlternativeText = sMapsURL
Exit Sub
RETURN_FALSE:
End Sub
Sub Streetview()
GoogleStaticStreetView Sheets(1).Shapes.AddShape(msoShapeRectangle, 0, 0, 512, 512), "[COLOR=#7D2727][FONT=Consolas]GooglePlex, CA 94043[/FONT][/COLOR]", 100
Debug.Assert False
Sheets(1).Shapes.Delete
End Sub
What i desire is to call this code from one of my userforms that holds 4 images and show 4 views (90 degree differences) of the location.
but i cant find the right syntax to amend this line
Code:
GoogleStaticStreetView Sheets(1).Shapes.AddShape(msoShapeRectangle, 0, 0, 512, 512), "[COLOR=#7D2727][FONT=Consolas]GooglePlex, CA 94043[/FONT][/COLOR]", 100
to do what i am looking for, i have tried multiple versions of
Code:
me.streetview1 = GoogleStaticStreetView (CRM_Main.CustName.Text & " " & CRM_Main.CustAddr.Text & " " & CRM_Main.CustPost.Text, 90)
me.streetview2 = GoogleStaticStreetView (CRM_Main.CustName.Text & " " & CRM_Main.CustAddr.Text & " " & CRM_Main.CustPost.Text, 180)
me.streetview3 = GoogleStaticStreetView (CRM_Main.CustName.Text & " " & CRM_Main.CustAddr.Text & " " & CRM_Main.CustPost.Text, 270)
me.streetview4 = GoogleStaticStreetView (CRM_Main.CustName.Text & " " & CRM_Main.CustAddr.Text & " " & CRM_Main.CustPost.Text, 360)
and editing the called sub to
Code:
Sub GoogleStaticStreetView(sAddress As String, _
lHeading As Long, _
Optional lHeight As Long = 512, _
Optional lWidth As Long = 512)
.......
but i just don't understand how the image is being handled, and how to get it into my userform images, can anyone help?
Thankyou!
EDIT: Source http://stackoverflow.com/questions/33573556/embed-a-google-street-view-image-into-excel
Last edited: