Link to home
Create AccountLog in
Avatar of borgtamer
borgtamerFlag for United States of America

asked on

Resolving Outlook Address book entry

I am trying to use a VBA macro to access a shared calendar. I have the GAL entry and have verified that it exists and is valid. Below is the code of the macro:
Public Function OpenSharedCalendar(Name As String) As Object
    Dim myOlApp As Object
    Dim myNamespace As Object
    Dim myRecipient As Object
    Dim fldr As Object
    Dim CalendarFolder As Object
    Set myOlApp = CreateObject("Outlook.Application")
    Set myNamespace = myOlApp.GetNamespace("MAPI")
    Set myRecipient = myNamespace.CreateRecipient("=" & Name)
    If myRecipient.Resolve Then
        Set CalendarFolder = Session.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
        MsgBox ("Could not resolve '" & Name & "' to obtain shared calendar")
        Set OpenSharedCalendar = Nothing
        Exit Function
    End If
    ' other code
   OpenSharedCalendar = fldr
End Sub

Open in new window

The problem is that

Open in new window

returns False. The argument passed to the function is "Project Management". In the Global Address List there are also entries "Project Management Analysis" and "Project Management Training". Hence the
"=" & Name

Open in new window

argument in CreateRecipient function.

Any ideas on what I am doing wrong? Thanks

Avatar of omgang
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of borgtamer


Did not completely solve the problem.