SPAM toolbar button and forwarding script

G

GB

Finally resolved my problem - Thanks Sue and others -

What the code (see below) does - Forwards SPAM in a low
priority email to a set email address and then deletes the
email from your inbox. The email is not marked as Junk (but
could be ) since most email addresses are fake and this
just clogs up your email filtering.
*****
The BEST thing this code does is solve the "A program is
trying to automatically send e-mail on your behalf" warning
message and the accompanying 5 second delay typically
received if you just use the VB Send command.
*****
I also recommend that you create a digital signature and
sign your VB project to prevent the VBA Macro Security
warning from occurring on your own code.

Refs:
- "Reinforcing Dialog-Based Security", Carlisle, Martin C.
and Studer, Scott D., US Air Force Academy

- "How to Prevent the VBA Macro Security Warning in
Microsoft Outlook", Groves, Jim, Microsoft, October 1999,
http://msdn.microsoft.com > MSDN Library

- Sue Mosher, (e-mail address removed) , VBA Newsgroup


Instructions for installing the VB code

1. In MS Outlook press ALT-F11 to enter the VB Editor
2. Paste the SpamHandler code below into the window
3. Change the email address from
(e-mail address removed) to whatever is specific
for your needs
4. Press Ctrl-S to save and Alt-Q to return to MS Outlook


Sub SpamHandler()
'Major portions of code courtesy of Sue Mosher
Dim objApp As Application
Dim objItem As Object
Dim objNewMsg As MailItem

Set objApp = CreateObject("Outlook.Application")
On Error Resume Next
Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set objItem =
objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set objItem = objApp.ActiveInspector.CurrentItem
End Select
If Not objItem Is Nothing Then
Set objNewMsg = objItem.Forward
If Not objNewMsg Is Nothing Then
objNewMsg.Importance = olImportanceLow
objNewMsg.To = "(e-mail address removed)"
objNewMsg.Display
SendKeys ("%S")
objItem.Delete
End If
End If

Set objNewMsg = Nothing
Set objItem = Nothing
Set objApp = Nothing
End Sub


Adding a Button on your Toolbar

1. In MS Outlook select Tools>Customize and click on the
Commands tab
2. Select Macros from the Categories list
3. SpamHandler should appear in the Commands window
4. Select SpamHandler and drag it onto your Menu toolbar
5. Right click on the new menu button and change the name
and change the button image to something meaningful that
will stand out on your Menu toolbar
6. Click the Close button on the Customize window when you
are satisfied with the look and name of your new Menu
toolbar button.
7. You can also repeat this step while reviewing an email
to add the button so it is available when you have an email
open.

Now when you are reviewing emails in your inbox you can
easily forward Spam to your corporate email support group
or other spam support group in one easy step.

GB
 

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