W
WD
I have written code to move meetings from my calendar to a public calendar.
All meetings move successfully except recurring meetings. Below is the code
that I am using. Each time I use the any of the recurring objects nothing
seems to happen or it fails. Any assistance would be appreciated. Code below:
Sub MoveMeetings()
'Move meetings from my personal calendar to the public calendar
Dim olFolder As MAPIFolder
Dim olFolderSAP As MAPIFolder
Dim ns As Outlook.NameSpace
Dim appts As Object
Dim appt As Object
Dim apptrec As Object
Dim SAPMeeting As Object
Dim date1 As Date
Dim date2 As Date
Dim I As Integer
Const strPublicFolder = "Public Folders\All Public Folders\SAP Calendar"
Set ns = Outlook.GetNamespace("MAPI")
Set olFolder = ns.GetDefaultFolder(olFolderCalendar)
Set appts = olFolder.Items
Set olFolderSAP = GetFolder(strPublicFolder)
Set SAPMeeting = olFolderSAP.Items.Add()
date1 = InputBox("Move items between - this date: ", "Start Date")
date2 = InputBox("and this date: ", "End Date")
For Each appt In appts
If Format(appt.Start, "short date") >= date1 And Format(appt.Start,
"short date") < date2 Then
Set apptrec = appt.GetRecurrencePattern
With SAPMeeting
.Subject = appt.ConversationTopic
.Start = appt.Start
.End = appt.End
.Location = appt.Location
.Organizer = appt.Organizer
.Body = appt.Body
.RequiredAttendees = appt.RequiredAttendees
.OptionalAttendees = appt.OptionalAttendees
.RecurrenceType = apptrec.RecurrenceType
.Interval = apptrec.Interval
.PatternEndDate = apptrec.PatternEndDate
.Save
End With
End If
Next appt
End Sub
WD
All meetings move successfully except recurring meetings. Below is the code
that I am using. Each time I use the any of the recurring objects nothing
seems to happen or it fails. Any assistance would be appreciated. Code below:
Sub MoveMeetings()
'Move meetings from my personal calendar to the public calendar
Dim olFolder As MAPIFolder
Dim olFolderSAP As MAPIFolder
Dim ns As Outlook.NameSpace
Dim appts As Object
Dim appt As Object
Dim apptrec As Object
Dim SAPMeeting As Object
Dim date1 As Date
Dim date2 As Date
Dim I As Integer
Const strPublicFolder = "Public Folders\All Public Folders\SAP Calendar"
Set ns = Outlook.GetNamespace("MAPI")
Set olFolder = ns.GetDefaultFolder(olFolderCalendar)
Set appts = olFolder.Items
Set olFolderSAP = GetFolder(strPublicFolder)
Set SAPMeeting = olFolderSAP.Items.Add()
date1 = InputBox("Move items between - this date: ", "Start Date")
date2 = InputBox("and this date: ", "End Date")
For Each appt In appts
If Format(appt.Start, "short date") >= date1 And Format(appt.Start,
"short date") < date2 Then
Set apptrec = appt.GetRecurrencePattern
With SAPMeeting
.Subject = appt.ConversationTopic
.Start = appt.Start
.End = appt.End
.Location = appt.Location
.Organizer = appt.Organizer
.Body = appt.Body
.RequiredAttendees = appt.RequiredAttendees
.OptionalAttendees = appt.OptionalAttendees
.RecurrenceType = apptrec.RecurrenceType
.Interval = apptrec.Interval
.PatternEndDate = apptrec.PatternEndDate
.Save
End With
End If
Next appt
End Sub
WD