franglais
franglais

Reputation: 938

Rule to save attachments on incoming emails not working on a fresh install of Outlook

We're migrating from one server to another and a VBA script to save attachments that was working has given up the ghost on the new server.

This is a fresh install of Outlook.

Script below:

Public Sub saveAttachmentAll(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String

saveFolder = "D:\www\phones"
For Each objAtt In itm.Attachments

    objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName

    Set objAtt = Nothing

    Next

End Sub

I've tested the Outlook rule and Outlook is performing other actions on it but this script isn't working!

Upvotes: 1

Views: 3170

Answers (1)

franglais
franglais

Reputation: 938

So it turns out I had to disable macro security (which isn't the best) and restart Outlook. Fairly simple, but I was scratching my head for a while...!

Upvotes: 1

Related Questions