troubleshooting Question

Open Outlook Calendar in the same window, using VBA

Avatar of malco8477
malco8477 asked on
Microsoft OfficeOutlook
5 Comments1 Solution1700 ViewsLast Modified:
Hi

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.

Malcolm

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")
myRecipient.Resolve
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)
CalendarFolder.Display
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
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