PDA

View Full Version : Macro - Categorise, forward and delete



MTD
08-16-2007, 06:30 AM
I give up:banghead: - well not totally. I've enrolled in a VBA basic course at the local college.... In the meantime, would any kind-hearted soul be able to help me with this macro? I've tried many times to try to write it using VBA help but it is literally a foreign language.

I would like a macro that assigns the category (one I've created) 'spam' to an e-mail that has been selected, then forward it to my work spam filter address 'spam@xxxxxx.com.au', then place the e-mail in the deleted items tray.

I've tried using rules but it still takes quite a few button clicks - I'm a one button kinda fella....

Any help would be greatly appreciated.
Cheers!

mvidas
08-16-2007, 11:26 AM
Hi MTD,

Welcome to VBAX :) Give the following a try: Sub MTDCategorize()
Dim MailItm As Object
If ActiveInspector Is Nothing Then 'if message not opened up full screen
Set MailItm = ActiveExplorer.Selection.Item(1)
Else
Set MailItm = ActiveInspector.CurrentItem
End If
MailItm.Categories = "spam"
MailItm.Save
With MailItm.Forward
.To = "spam@xxxxxx.com.au"
.Send '.Display
End With
MailItm.Delete
End Sub