Passing URL to Google

A

ardy

I have found a code that suppose to pass collected variables from text
boxes in a form to construct a URL and pass it onto a web browser and
locate the address in google map. the code executes with no error but
no browser opens up. any help is appreciated.......
if this is a wrong group please point me to the right one.
------------------------Start-------------------------------
Private Sub GoogleMapsLink_Click()

Dim strLinkUrl As String
Dim strPath As String
Dim strAddr() As String

strPath = "http://maps.google.com/maps?q="

strLinkUrl = RTrim(streetnumber.Value) & "+" & RTrim(city.Value) & "+"
& RTrim(state.Value)
strAddr = Split(strLinkUrl, " ", , vbTextCompare)
strLinkUrl = ""
For i = LBound(strAddr()) To UBound(strAddr())
strLinkUrl = strLinkUrl & strAddr(i) & "+"
Next i
strLinkUrl = strPath & Left(strLinkUrl, Len(strLinkUrl) - 1)
Debug.Print strLinkUrl
Me.GoogleMapsLink.HyperlinkAddress = strLinkUrl

End Sub
 
A

ardy

You have to add a command to actually follow the hyperlink:
Me.GoogleMapsLink.Hyperlink.Follow

Peterhttp://access.xps350.com/

Hello Peter:
Thank you very much for replying. I am not a programmer by trade. I
have tried both Me.GoogleMapsLink.Hyperlink.Follow = strLinkUrl and
Me.GoogleMapsLink.HyperlinkAddress.Follow = strLinkUrl. I get no
result. Under the Debug I Tried to compile and get the following
Compile Error.
----
Me.GoogleMapsLink.Hyperlink.Follow = strLinkUrl => >Follow gets
Highlighted and I get Compile Error Dialog box "Expected Function or
Variable"

Me.GoogleMapsLink.HyperlinkAddress.Follow = strLinkUrl =>
HyperlinkAddress gets Highlighted and I get Compile Error Dialog box
"Expected Function or Variable"
 
X

XPS350

I haven't tried it, but I think adding the line of code to your code will do.

So:
..
..
Me.GoogleMapsLink.HyperlinkAddress = strLinkUrl
Me.GoogleMapsLink.Hyperlink.Follow

Peter
 
A

ardy

I haven't tried it, but I think adding the line of code to your code willdo.

So:
.
.
Me.GoogleMapsLink.HyperlinkAddress = strLinkUrl
Me.GoogleMapsLink.Hyperlink.Follow

Peter

OK This Worked
Me.GoogleMapsLink.HyperlinkAddress = strLinkUrl

it seems that we don't need the .Follow

Thanks for all your help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top