Const URL_BASE As String = _
"http://maps.google.com/maps?f=q&hl=en&geocode=&time=&date=&ttype=&q=@ADDR@&ie=UTF8&t=@TYPE@"
Dim addr As String
Dim url As String
' A very simple URL encoding.
addr = txtAddress.Text
addr = Replace$(addr, " ", "+")
addr = Replace$(addr, ",", "%2c")
' Insert the encoded address into the base URL.
url = Replace$(URL_BASE, "@ADDR@", addr)
' Insert the proper type.
Select Case cboGoogle.Text
Case "Map"
url = Replace$(url, "@TYPE@", "m")
Case "Satellite"
url = Replace$(url, "@TYPE@", "h")
Case "Terrain"
url = Replace$(url, "@TYPE@", "p")
End Select
' "Execute" the URL to make the default browser display
' it.
ShellExecute ByVal 0&, "open", url, _
vbNullString, vbNullString, SW_SHOWMAXIMIZED
Unload Me