How to get subscription attachments to save to disk

Email It to Me Print this Page
Question How do I get Subscription report attachments to save to disk?
Answer This will require Outlook and an Outlook rule to save the attachment to disk.

Follow the steps below to create an Outlook rule that will output the attachment to a specified location:
  1. Open the VBA IDE in Outlook(Shortcut key is Alt-F11)
  2. Insert the code below into the Modules section, you can find Modules by expanding the tree on the left side until you see Modules (If there is not a Module item under Modules, create one by Right-Clicking on Modules and choose Insert -> Module)
  3. Public Sub saveAttachtoDisk (itm As Outlook.MailItem)
    Dim objAtt As Outlook.Attachment
    Dim saveFolder As String
    saveFolder = "c:\temp\"
         For Each objAtt In itm.Attachments       
              objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName       
              Set objAtt = Nothing   
    End Sub
  4. Where it says "saveFolder" in the code above, modify this to match the destination of your choice.
  5. Paste the code above into the main VBA window
  6. Close out of the VBA IDE
This will allow you to use this script in the rules section. Follow the steps below to create the Outlook rule that will use this:
  1. Create a new Rule(Tools -> Rules and Alerts -> New Rule)
  2. On the first screen, select "Check messages when they arrive"
  3. On the next screen, specify criteria that will match the message you get for subscriptions(I.E Search for attachment extension type, or specific words in the subject/body)
  4. On the third screen, choose "Run a script". You should be able to click the underlined word "Script" and see the code pasted from earlier
  5. Click "Finish"
After these steps have been performed, when you receive a Subscription e-mail, the attachment should be saved to the location you specified in the code.
Was this information helpful?