Public Function BingMap() As Boolean On Error GoTo Fout
Dim smap As String, sUrl As String, sextr As String
'MsgBox Me.Straat & Me.Hn & " " & Me.Pcstad & Me.Stad & Me.Land
smap = UrlMapadresBing(Me.Straat, Me.Hn, Me.Pcstad, Me.Stad, Me.Land)
If Len(smap) > 10 Then
'With KnBingMap.HyperlinkAddress =
sUrl = "http://maps.live.com/default.aspx"
sextr = "where1=" & smap & "&lvl=15&dir=0&sty=r"
Application.FollowHyperlink sUrl, , False, True, sextr
Else
Call PauzeTxtBeep("Te weinig gegevens voor een Bingmap ", 1)
End If
Exit_fout:
Exit Function
Fout:
MsgBox Err.description
Resume Exit_fout
End Function
Public Function GoogleMap() As Boolean
On Error GoTo Fout
Dim mapurl As String
Dim sUrl As String, sextr
GoogleMap = False
mapurl = Trim(UrlMapadres(Me.Straat, Me.Hn, Me.Pcstad, Me.Stad, Me.Land))
'MsgBox mapurl
If Len(mapurl) > 10 Then
'call pauzetxt(mapurl,.5) 'https://maps.google.com/maps?output=classic&dg=ntvb
'KnGooglemap.HyperlinkAddress = "https://www.google.com/maps?q=" & mapurl
sUrl = "https://www.google.com/maps?q=" & mapurl
'KnGooglemap.Hyperlink.Follow
'KnGooglemap.HyperlinkAddress = "https://www.google.com/maps?q=" & mapurl
Application.FollowHyperlink sUrl, , False, True, sextr
GoogleMap = True
Else
Beep
Call PauzeTxtBeep("Te weinig gegevens voor Googlemaps", 0.7)
End If
Exit_fout:
Exit Function
Fout:
MsgBox Err.description
Resume Exit_fout
End Function
Public Function UrlMapadres(Straat As Variant, Hn As Variant, zip As Variant, Stad As Variant, Land As Variant) As String
Dim mztools As Integer
On Error GoTo Fout
Dim hURL As String
'hURL = "Http://maps.google.com/maps?q="
hURL = " "
If Len(Trim(Nz(Straat))) > 0 Then
Straat = Replace(Straat, " ", "+")
hURL = hURL & Straat
End If
If Len(Trim(Nz(Hn))) > 0 Then
Hn = Replace(Hn, " ", "+")
hURL = hURL & "," & Hn
End If
If Len(Trim(Nz(zip))) > 0 Then
zip = Replace(zip, " ", "+")
hURL = hURL & "," & zip
End If
If Len(Trim(Nz(Stad))) > 0 Then
Stad = Replace(Stad, " ", "+")
hURL = hURL & "," & Stad
End If
If Len(Trim(Nz(Land))) > 0 Then
Land = Replace(Land, " ", "+")
hURL = hURL & "," & Land
End If
If Left(hURL, 2) = " ," Then hURL = Right(hURL, Len(hURL) - 2)
UrlMapadres = Trim(hURL)
Uit:
Exit Function
Fout:
MsgBox Err.description
End Function
Public Function UrlMapadresBing(Straat As Variant, Hn As Variant, zip As Variant, Stad As Variant, Land As Variant) As String
Dim mztools As Integer
On Error GoTo Fout
'mapurl = UrlMapadresBing(Me.Straat, Me.Hn, Me.Pcstad, Me.Stad, Me.Land)
Dim hURL As String
'hURL = "Http://maps.google.com/maps?q="
hURL = ""
If Land = "USA" Then
If Len(Trim(Nz(Hn))) > 0 Then
Hn = Replace(Hn, " ", "%20")
hURL = hURL & " " & Hn
End If
If Len(Trim(Nz(Straat))) > 0 Then
Straat = Replace(Straat, " ", "%20")
hURL = hURL & " " & Straat
End If
Else
If Len(Trim(Nz(Straat))) > 0 Then
Straat = Replace(Straat, " ", "%20")
hURL = hURL & " " & Straat
End If
If Len(Trim(Nz(Hn))) > 0 Then
Hn = Replace(Hn, " ", "%20")
hURL = hURL & " " & Hn
End If
End If
If Land <> "usa" Then
If Len(Trim(Nz(zip))) > 0 Then
zip = Replace(zip, " ", "%20")
hURL = hURL & "," & zip
End If
If Len(Trim(Nz(Stad))) > 0 Then
Stad = Replace(Stad, " ", "%20")
hURL = hURL & " " & Stad
End If
Else
If Len(Trim(Nz(Stad))) > 0 Then
Stad = Replace(Stad, " ", "%20")
hURL = hURL & "," & Stad
End If
If Len(Trim(Nz(zip))) > 0 Then
zip = Replace(zip, " ", "%20")
hURL = hURL & " " & zip
End If
End If
If Len(Trim(Nz(Land))) > 0 Then
Land = Replace(Land, " ", "%20")
hURL = hURL & "," & Land
End If
'hURL = hURL & "%20 &style=r"
UrlMapadresBing = Trim(hURL) '& "&cid=C8A777871D6A19DF!1401"
'MsgBox hURL
'cid=C8A777871D6A19DF!1341&form=LMLTCC
'&lvl=14&dir=0&sty=r&cid=C8A777871D6A19DF!1341&form=LMLTCC
Uit:
Exit Function
Fout:
MsgBox Err.description
End Function