troubleshooting Question

Open Outlook Calendar in the same window, using VBA

Avatar of malco8477
malco8477 asked on
OutlookMicrosoft Office
5 Comments1 Solution1700 ViewsLast Modified:

I have Outlook 2010 and (manually) I can switch on another shared calendar by just clicking the box before it in My Calendars.

But I would like to be able to do this progammatically.

I have tried the code below, which works but does NOT open the calendar in the same window.

I have tried using ActiveExplorer which I believe should allow Outlook to open the calendar in the same window, but without success.

Any help would be greatly appreciated.


Sub test()
Dim myOlApp As Outlook.Application
Dim myNamespace As Outlook.NameSpace
Dim myRecipient As Outlook.Recipient
Dim CalendarFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myRecipient = myNamespace.CreateRecipient("desk1tr1")
If myRecipient.Resolved Then
Call ShowCalendar(myNamespace, myRecipient)
End If

End Sub

Sub ShowCalendar(myNamespace, myRecipient)
Dim CalendarFolder As Outlook.MAPIFolder
Set CalendarFolder = _
myNamespace.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
End Sub
Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros