Function KartenAnzeige()
On Error GoTo fehler
Dim doc As WebBrowser, str As String, strK(10) As String, strI As String
Dim strOrt(10) As String, strStrasse(10) As String, strHausnummer(10) As String, strPLZ(10) As String
For i = 1 To 3
If i = 1 Then
strI = ""
Else
strI = i
End If
Me("Strasse" & strI).SetFocus
If Me("Strasse" & strI).Text = "" Then
If i = 1 Then Exit Function
Exit For
End If
strStrasse(i) = Me("Strasse" & strI).Text
Me("Hausnummer" & strI).SetFocus
strHausnummer(i) = Me("Hausnummer" & strI).Text
Me("PLZ" & strI).SetFocus
strPLZ(i) = Me("PLZ" & strI).Text
Me("Ort" & strI).SetFocus
If Me("Ort" & strI).Text = "" Then
If i = 1 Then Exit Function
Exit For
End If
strOrt(i) = Me("Ort" & strI).Text
'Konvertierung zu UTF-8
'**********************
Dim kl As New Klasse1
strOrt(i) = kl.ANSIToUTF8(strOrt(i)): strStrasse(i) = kl.ANSIToUTF8(strStrasse(i))
'Koordinaten ermitteln
'**********************
' lat = 0: lon = 0
strK(i) = GetAddressCoord(strStrasse(i) & "+" & strHausnummer(i) & "+" & strOrt(i))
' strL = lat & "," & lon
' strK2 = GetAddressCoord(Me!Strasse2 & " " & Me!Hausnummer2 & " " & Me!Ort2, AccStreet, lat, lon)
' strL2 = lat & "," & lon
' strK3 = GetAddressCoord(Me!Strasse3 & " " & Me!Hausnummer3 & " " & Me!Ort3, AccStreet, lat, lon)
' strL3 = lat & "," & lon
Next i
Me!Zoom.SetFocus
If Me!Zoom.Text = "" Or IsNull(Me!Zoom) Then
Me!Zoom.Text = intZoom
End If
'Kartenausschnitt ausgeben
'*************************
str = "<!DOCTYPE html PUBLIC ""-//W3C//DTD XHTML 1.0 Strict//EN"" ""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"">" & vbCrLf & _
"<html>" & vbCrLf & _
"<head>" & vbCrLf & _
"<meta http-equiv=""content-type"" content=""text/html; charset=UTF-8""/>" & vbCrLf & _
"<title>Google Maps</title>" & vbCrLf & _
"<script src=""http://maps.google.com/maps?file=api&v=2&sensor=false&key=ABQIAAAAPDUET0Qt7p2VcSk6JNU1sBSM5jMcmVqUpI7aqV44cW1cEECiThQYkcZUPRJn9vy_TWxWvuLoOfSFBw"" type=""text/javascript""></script>" & vbCrLf & _
"</head>" & vbCrLf & _
"<body onunload=""GUnload()"">" & vbCrLf & _
"<div id=""map"" style=""width: 425px; height: 350px""></div>" & vbCrLf & _
"<noscript><b>JavaScript must be enabled in order for you to use Google Maps.</b>" & vbCrLf & _
"However, it seems JavaScript is either disabled or not supported by your browser." & vbCrLf & _
"To view Google Maps, enable JavaScript by changing your browser options, and then" & vbCrLf & _
" try again." & vbCrLf & _
"</noscript>" & vbCrLf & _
"<script type=""text/javascript"">" & vbCrLf & _
"//<![CDATA[" & vbCrLf & _
"if (GBrowserIsCompatible()) {" & vbCrLf & _
"function createMarker(point,html) {" & vbCrLf & _
"var marker = new GMarker(point);" & vbCrLf & _
"GEvent.addListener(marker, ""click"", function() {" & vbCrLf & _
"marker.openInfoWindowHtml(html);"
str = str & vbCrLf & _
"});" & vbCrLf & _
"return marker;" & vbCrLf & _
"}" & vbCrLf & _
"var map = new GMap2(document.getElementById(""map""));" & vbCrLf & _
"map.addControl(new GLargeMapControl());" & vbCrLf & _
"map.addControl(new GMapTypeControl());" & vbCrLf
str = str & _
"map.setCenter(new GLatLng(" & strK(1) & ")," & Me!Zoom & ");" & vbCrLf & _
"var point = new GLatLng(" & strK(1) & ");" & vbCrLf & _
"var marker = createMarker(point,'<div style=""width:240px"">Some stuff to display in the First Info Window. With a <a href=""http://www.econym.demon.co.uk"">Link<\/a> to my home page<\/div>')" & vbCrLf & _
"map.addOverlay(marker);" & vbCrLf & _
"var point = new GLatLng(" & strK(2) & ");" & vbCrLf & _
"var marker = createMarker(point,'Some stuff to display in the<br>Second Info Window')" & vbCrLf & _
"map.addOverlay(marker);" & vbCrLf & _
"var point = new GLatLng(" & strK(3) & ");" & vbCrLf & _
"var marker = createMarker(point,'Some stuff to display in the<br>Third Info Window')" & vbCrLf & _
"map.addOverlay(marker);" & vbCrLf & _
"}"
'display a warning if the browser was not compatible
str = str & "else {" & vbCrLf & _
"alert(""Sorry, the Google Maps API is not compatible with this browser"");" & vbCrLf & _
"}" & vbCrLf & _
"</script>" & vbCrLf & _
"</body>" & vbCrLf & _
"</html>"
Open "C:\temp\temp.htm" For Output As #1
Print #1, str
Close #1
'FollowHyperlink "C:\temp\temp.htm"
'Exit Function
Set doc = ctlWeb.Object
doc.Navigate "C:\temp\temp.htm"
'doc.Document.body.innerHTML = str
Exit Function
fehler:
Debug.Print Err.Description, Err.Number
'If Err.Number <> 2475 Then
'Resume Next
End Function