landnw@gmail.com
New member
- Local time
- Yesterday, 16:06
- Joined
- Apr 12, 2017
- Messages
- 2
I am trying to link an Outlook public calendar to a button on a form that opens that specific calendar. I am opening the file based on the Entry ID, however, once Outlook is closed, and I attempt to reopen the calendar via the button, it won't work.
Here is the code I used to find the Entry ID:
Private Sub FolderPicker_Click()
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Set olfolder = olapp.GetNamespace("MAPI").PickFolder
olfolder.Display
Debug.Print olfolder.EntryID
Set olfolder = Nothing
Set olapp = Nothing
End Sub
I then use the Entry ID in the following code:
Private Sub GetFolderFromID_Click()
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Set olfolder = olapp.GetNamespace("Mapi").GetFolderFromID("000000001A447390AA6611CD9BC800AA002FC45A0300F46D37F3A6D9214C8EE72B344E69DDAF0000368A08CF0000")
olfolder.Display
Set olfolder = Nothing
Set olapp = Nothing
End Sub
It works fine if I run the first set of code first, and then click the button to open the Calendar. However, if I close the database, or close Outlook, the code errors out on the "set olfolder" line. It's like it doesn't know where its trying to point to. Any help would be greatly appreciated.
Here is the code I used to find the Entry ID:
Private Sub FolderPicker_Click()
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Set olfolder = olapp.GetNamespace("MAPI").PickFolder
olfolder.Display
Debug.Print olfolder.EntryID
Set olfolder = Nothing
Set olapp = Nothing
End Sub
I then use the Entry ID in the following code:
Private Sub GetFolderFromID_Click()
Dim olfolder As Outlook.MAPIFolder
Dim olapp As Outlook.Application
Set olapp = CreateObject("Outlook.Application")
Set olfolder = olapp.GetNamespace("Mapi").GetFolderFromID("000000001A447390AA6611CD9BC800AA002FC45A0300F46D37F3A6D9214C8EE72B344E69DDAF0000368A08CF0000")
olfolder.Display
Set olfolder = Nothing
Set olapp = Nothing
End Sub
It works fine if I run the first set of code first, and then click the button to open the Calendar. However, if I close the database, or close Outlook, the code errors out on the "set olfolder" line. It's like it doesn't know where its trying to point to. Any help would be greatly appreciated.