Rule does not execute VBA script



I've created a VBA script which is executed by a rule in Outlook. If the
e-mail has an attachment, then script copies it to a Windows folder then
deletes the e-mail.

The script work fine on Windows 2000 workstation running Outlook 2003.
However, when I set up the same rule and script on a workstation running
Outlook 2002, the rule works (it deletes the e-mail), but does not execute
the script. I know this for certain, as I inserted breakpoints within the

The script is has been placed in the 'ThisOutlookSession' module and the
name of the script does show up in the drop down box in the Rules Wizard.
I've set the Macro Security to low, compiled the code and made sure I
restarted Outlook when either changing the code or the rule.

Here's the code:

Sub HLC(olMsg As Outlook.MailItem)

Dim olAtt As Outlook.Attachments
Set olAtt = olMsg.Attachments

ImpFile = olAtt.item(1).FileName
olAtt.item(1).SaveAsFile "C:\WINNT\Temp\" + ImpFile

Set olAtt = Nothing
Set olMsg = Nothing

End Sub

Any ideas would be appreciated.



Sue Mosher [MVP-Outlook]

I would set Macro Security to Medium and put some code in the Application_Startup event. That should force Outlook to prompt you, so you'll know for sure that VBA is runniing.

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