Article ID: 175962
Article Last Modified on 1/22/2007
Dim Outlook As Object
Dim oMAPI As Object
Dim oCalendar As Object
Dim oAppt As Object
Dim oViewCmdBar As Object
Dim oItem As Object
Dim nItem As Integer
' Create Outlook Application object.
Set Outlook = CreateObject("Outlook.Application")
Set oMAPI = Outlook.GetNameSpace("MAPI")
' Retrieve the Calendar folder.
Set Calendar = mapi.GetDefaultFolder(olFolderCalendar)
' You can retrieve your specific appointment differently.
' This is just to get the first item, so we can see the calendar
' displayed for that day.
Set oAppt = oCalendar.Items(1)
' Retrieve the View menu.
Set oViewCmdBar = oAppt.GetInspector.CommandBars.Item("View")
' Locate "Calendar..." on the View menu.
nItem = 1
Set oItem = oViewCmdBar.Controls(nItem)
Do While Not oItem.Caption = "Ca&lendar..."
nItem = nItem + 1
Set oItem = oViewCmdBar.Controls(nItem)
Loop
' Display the appointment. This must be done in order for the
' calendar to be displayed on the next statement.
oAppt.GetInspector.Display
' Execute the Calendar command on the View menu.
' This is the command that displays the calendar.
oItem.Execute
166368 OL97: How to Get Help Programming with Outlook
170783 OL97: Q&A: Questions About Customizing or Programming Outlook
Additional query words: kbmacro vba OutSol OutSol97
Keywords: kbcode kbhowto kbinterop kbprogramming KB175962