Saving attachment then deleting it from message

Hello;

I get a report everyday with an attachment in it.  (Outlook 2010) I need to strip the attachment and save it to a different folder automatically, I would then then like to delete the attachment from the email, all automatically when the email is delivered. (Outlook 2010 is opened and running 24/7). I am VERY new to this so if anyone answers please make it as simple and well explained - type very slowly cause I don't figure this out too quickly - LOL.

Thanks ahead of time

James_53

March 5th, 2015 9:09am

Hello,

Yes attachments can be saved to another folder automatically by using a rule in Outlook. And rules in Outlook are constructed by using VBA code. So to construct a VBA code,

  • Open the VBA IDE by pressing ALT+F11 from Outlook.
  •  Then move to insert tab & open a module. Paste the following given code there:
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    
     Next
End Sub
  • Close the Editor. Open the Outlook once again in order to call the created script. And to do so move to Tools>> Rules & Alerts >> New Rule.
  • In the first section, select the option check message when they arrive. And then click next.
  • Now select with specific words in the message header and .txt. Specify the senders name from whose mail you want to save the attachment. Click next to proceed further.
  • After this select run a script. Now under the word Script, you will find the VBA code you have just constructed. Select the following code and continue by clicking next.
  • At the end click finish.

Now a rule has been created to automatically save the attachments on your local machine.

Regards

Clark Kent

Free Windows Admin Tool Kit Click here and download it now
March 7th, 2015 12:53am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics