Consulting

Results 1 to 2 of 2

Thread: Macro to delete Calendar Entries w/Attachments

  1. #1
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location

    Macro to delete Calendar Entries w/Attachments

    Does any one have an Outlook macro that I can run against my Calendar that would optionally:

    1. Delete all entries that have attachments prior to an input date
    2. Delete all entries prior an input date

    Some might be recurring meetings

    Right now, I'm doing Views and sorts and manually deleting such things


    Thanks

    Paul

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    Maybe this will help to get you started.[VBA]Sub delete_meeting_before()
    Dim mydate As Date
    Dim mymeeting As Outlook.AppointmentItem
    Dim myfolder As MAPIFolder
    Dim myattstring As String
    Dim vloop As Long
    Set myfolder = Application.Session.GetDefaultFolder(olFolderCalendar)
    mydate = DateSerial(2008, 1, 1)
    For vloop = 1 To myfolder.Items.Count
    Set mymeeting = myfolder.Items(vloop)
    If mymeeting.Attachments.Count > 0 Then
    myattstring = "Attachments : " & mymeeting.Attachments.Count
    Else
    myattstring = "No attachments found."
    End If
    If mymeeting.Start < mydate And mymeeting.End < mydate Then
    MsgBox mymeeting.Subject & vbCrLf & mymeeting.Start & " - " & _
    mymeeting.End & vbCrLf & myattstring, _
    vbInformation, "To be deleted ..."
    Else
    MsgBox mymeeting.Subject & vbCrLf & mymeeting.Start & " - " & _
    mymeeting.End & vbCrLf & myattstring, _
    vbInformation, "NOT to be deleted ..."
    End If
    Next vloop
    End Sub[/VBA]Charlize

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •