BrianExcel
Well-known Member
- Joined
- Apr 21, 2010
- Messages
- 975
I am using code to generate a URL and open Chrome to navigate to that URL. However, what's happening now is that a tab within Chrome is being entered for each field I am passing *address, city, state, etc.) rather that 1 tab opening with a single URL.
The other complication, is that when I open Chrome manually and enter the same URL physically into the address box, the window opens just fine.
Any idea how I can stop that from happening? Here is the code.
The other complication, is that when I open Chrome manually and enter the same URL physically into the address box, the window opens just fine.
Any idea how I can stop that from happening? Here is the code.
Code:
Sub btnSubmitForDirections_Click()Dim sAddress As String, sCity As String, sState As String, sZip As String, sStartPoint As String
Dim eAddress As String, eCity As String, eState As String, eZip As String, sEndPoint As String
With EnterDirections
sAddress = .txtAddress
sCity = .txtCity
sState = .cmbState
'sZip = .txtZip
End With
For x = 0 To UserForm1.lbxSiteInfo.ListCount - 1
If UserForm1.lbxSiteInfo.Selected(x) Then
eAddress = UserForm1.lbxSiteInfo.List(x, 3)
eCity = UserForm1.lbxSiteInfo.List(x, 4)
eState = UserForm1.lbxSiteInfo.List(x, 5)
'eZip = UserForm1.lbxSiteInfo.List(x, 6)
End If
Next
sStartPoint = sAddress & ", " & sCity & ", " & sState
sEndPoint = eAddress & ", " & eCity & ", " & eState
sWebURL = "https://www.google.com/maps/dir/" & sStartPoint & "/" & sEndPoint
Unload Me
Shell ("C:\Program Files (x86)\Google\Chrome\Application\Chrome.exe -url " & sWebURL)
End Sub