auto delete an email after reading...

  • Thread starter Thread starter Brad Pears
  • Start date Start date
B

Brad Pears

We have a situation where when a particular email is
sent, I would like to run some code that detects this
message has come into the users inbox (based on content
in the subject area - it will always be the same), then
bring the email up to be read (no matter what the user is
doing at the time) and as soon as the user exists the
email, automatically permanently delete the email.

How would I do this - I know VB a bit but have never done
any VBA in Outlook.

Thanks,

Brad
 
Code in an Outlook form won't run unless the user has published that
form in their Outlook. A COM addin could be used but the user would
have to install it. You can't control things like that without the
user's cooperation.

For an Outlook macro that handles ItemAdd in the Inbox see
http://www.slipstick.com/dev/code/zaphtml.htm#cw

That code can be modified to do what you want.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
Please post some of the preceding thread in your messages. That
horrendous developersdex interface you are using doesn't do that and
it makes it very hard to follow a thread that way.

If you look at that code sample I pointed you at you will see how to
get an incoming message. Once you have that you can get Item.Subject
to get the subject into a string variable. Then you can parse it for
whatever content you want. Item.Delete will then delete the message.

I'd start out by looking at http://www.slipstick.com/books/dev.htm for
Outlook development books. For beginner's I recommend Sue Mosher's
Jumpstart book. It's very good. For more general Outlook development
information and lots of code samples start at
http://www.slipstick.com/dev/index.htm

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
 
Back
Top