Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Outlook Rule does not execute VBA script

Status
Not open for further replies.

esvee

IS-IT--Management
Jun 27, 2002
15
AU
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 code.

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.

Thanks

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top