A
Andy Pope
Hi,
I have OL 2007 with 2 calendars. The default and a new one I named
Calendar21. (This is not a shared calendar, if that makes a difference)
With VBA, which I run from Excel, I am trying to create a reference to
Calendar21 and add an appointment.
The following code fails at the line marker '<<<<
What code should I be using to locate and create a reference to required
calendar?
'-------
Dim objOL As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olFolder1 As Outlook.Folder
Dim olFolder2 As Outlook.Folder
Dim objItem As Outlook.AppointmentItem
Dim lngRow As Long
Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set olFolder1 = olNS.GetDefaultFolder(olFolderCalendar)
Set olFolder2 = olFolder1.Folders("Calendar21") '<<<<
'-------
I have no problem adding items to the default calendar.
Any insight greatly received.
Cheers
Andy
I have OL 2007 with 2 calendars. The default and a new one I named
Calendar21. (This is not a shared calendar, if that makes a difference)
With VBA, which I run from Excel, I am trying to create a reference to
Calendar21 and add an appointment.
The following code fails at the line marker '<<<<
What code should I be using to locate and create a reference to required
calendar?
'-------
Dim objOL As Outlook.Application
Dim olNS As Outlook.Namespace
Dim olFolder1 As Outlook.Folder
Dim olFolder2 As Outlook.Folder
Dim objItem As Outlook.AppointmentItem
Dim lngRow As Long
Set objOL = CreateObject("Outlook.Application")
Set olNS = objOL.GetNamespace("MAPI")
Set olFolder1 = olNS.GetDefaultFolder(olFolderCalendar)
Set olFolder2 = olFolder1.Folders("Calendar21") '<<<<
'-------
I have no problem adding items to the default calendar.
Any insight greatly received.
Cheers
Andy