How to Map Meeting Location Directly within Outlook? RRS feed

  • Question

  • Hi All,

    I am trying to Map Meeting Location Directly within Outlook  following this example:

      Dim objMeeting As Outlook.AppointmentItem
        Dim strMeetingLocation As String
        Dim strURL As String
        Dim objExplorer As Explorer
        Dim objWebBrowser As Object
        On Error Resume Next
        Select Case TypeName(Outlook.Application.ActiveWindow)
               Case "Inspector"
                    Set objMeeting = ActiveInspector.CurrentItem
               Case "Explorer"
                    Set objMeeting = ActiveExplorer.Selection.Item(1)
        End Select
        strMeetingLocation = objMeeting.Location
      MsgBox "message1" + strMeetingLocation
        If strMeetingLocation <> "" Then
           MsgBox "message2" + strMeetingLocation
           'Use Google Maps
           strURL = googlemapurl & strMeetingLocation
           'Open the map of the meeting location within Outlook
           Set objExplorer = Application.ActiveExplorer
           Set objWebBrowser = objExplorer.CommandBars.FindControl(, 1740)
           objWebBrowser.Text = strURL
           MsgBox "message3" + strURL
           MsgBox "Invalid Location", vbExclamation
        End If

    the map is not launched, 

    Firstly, I got compile time error on the line of "Dim objWordDocument As Word.Document"  , so I think that is my word issue, so I remove this line of codes (I don't think I need it),

    then the code is running well, but nothing happened, the Google map is not launched at all.

    I debugged the code, and found that  this line code: strMeetingLocation = Replace(strMeetingLocation , " ", "-")     may cause the problem, so I remove it,

    and find the location of my calendar are passed in properly, and if I  manually run the url code  from my browser, the google map is opened with no problem, but it does not work within the code,

    Does anybody know why?

    Much appreciated,      

    since I am not able to post URL link in this post, so I changed the real google url to "googlemapurl", it should be: http://+ maps+google+com/maps?q=

    • Edited by Mashkig Friday, July 19, 2019 2:24 PM add
    Friday, July 19, 2019 2:21 PM

All replies