Macro to delete Out of Office Messages


M

Margo2012

I am new to VBA and have searched for a macro to delete all existing ou
of office replies in Outlook 2007. What would be a good macro to use
 
Ad

Advertisements

C

chirag.stellar

Margo2012;360197 said:
I am new to VBA and have searched for a macro to delete all existing ou
of office replies in Outlook 2007. What would be a good macro to use?

Hi Margo,

"Out of Office" is a wonderful tool to manage email mailbox in outlook
you can use this code http://tinyurl.com/ce52uh5 .

I hope that it will work for you
 
M

Margo2012

chirag.stellar;360199 said:
Hi Margo,

"Out of Office" is a wonderful tool to manage email mailbox in outlook
you can use this code http://tinyurl.com/ce52uh5 .

I hope that it will work for you.

Thank you for the link, however this is not what I am look for. I hav
to send a lot of emails for work and get a huge number of out of offic
reply. I am looking for a macro to delete all of these out of offic
replies at once
 
Ad

Advertisements

M

Michael Bednarek

I am new to VBA and have searched for a macro to delete all existing out
of office replies in Outlook 2007. What would be a good macro to use?

Out-of-office replies can be deleted if you can describe a way to
identify them. In my experience, that is not reliably possible. If you
sort the message list by subject, those messages should appear together
and can then easily be deleted manually.

The following code should get you started; it will delete all messages
in the current folder whose subject line starts with "Out of Office".

Option Explicit
Sub DelOutOfOffice()

Dim lngItems As Long
Dim i As Long
Dim lngDels As Long

lngDels = 0
With ActiveExplorer.CurrentFolder
lngItems = .Items.Count
For i = lngItems To 1 Step -1
If Left(.Items(i).Subject, 13) = "Out of Office" Then
Debug.Print .Items(i).Subject
.Items(i).Delete
lngDels = lngDels + 1
End If
Next i
End With
MsgBox lngDels & " items deleted.", vbOKOnly + vbInformation, _
"DelOutOfOffice"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top