Hi I am new to VB and I have been tasked with adding a bit of code into a macro to replace and delete duplicate calendar items. For intance if a meeting was scheduled for 22-oct-2014 @9am but the meeting changed to 10am I am looking to delete the entry for 9am within the calendar. As I am new to VB I am unsure whether to use a delete or a replace command. The existing code is:
Private Sub Copy(ByRef Item As Object)
Dim folderID As String 'ID for folder
folderID = "00000000..." 'Set folder ID value
Dim storeID As String 'ID for store
storeID = "0000000030..." 'Set store ID value
Dim objCalendarFolder As Outlook.Folder 'Folder for additional calendar
Set objCalendarFolder = Outlook.Application.Session.GetFolderFromID(folderID, storeID)
If (Not objCalendarFolder Is Nothing) Then
Dim currentAppt As AppointmentItem
If TypeOf Item Is AppointmentItem Then
Set currentAppt = Item
Else
Set currentAppt = Item.GetAssociatedAppointment(False) 'Call get current item function
End If
Call currentAppt.Copy.Move(objCalendarFolder)
Set currentAppt = Nothing
End If
End Sub
I was thinging along the lines of in laymans terms
If Item = True
Replace
Else Exit
Private Sub Copy(ByRef Item As Object)
Dim folderID As String 'ID for folder
folderID = "00000000..." 'Set folder ID value
Dim storeID As String 'ID for store
storeID = "0000000030..." 'Set store ID value
Dim objCalendarFolder As Outlook.Folder 'Folder for additional calendar
Set objCalendarFolder = Outlook.Application.Session.GetFolderFromID(folderID, storeID)
If (Not objCalendarFolder Is Nothing) Then
Dim currentAppt As AppointmentItem
If TypeOf Item Is AppointmentItem Then
Set currentAppt = Item
Else
Set currentAppt = Item.GetAssociatedAppointment(False) 'Call get current item function
End If
Call currentAppt.Copy.Move(objCalendarFolder)
Set currentAppt = Nothing
End If
End Sub
I was thinging along the lines of in laymans terms
If Item = True
Replace
Else Exit