Jump to content

saving attachments to folder when email arrives.


Recommended Posts

Posted

every day i get a word document via email and i have to save the attachment to a network location.

is it possible, (using the outlook rules, batch file, vbs file, ) to automatically save the attachment to a folder?

keep in mind that the attachment's name changes every day.

example...today's file is called 06112009.doc


Posted (edited)

nevermind...i figured it out.

i created a macro in outlook and here is the code

now keep in mind the line of code Set TopFolder = MAPI.Folders.Item("Mailbox - Name of Person")

the part "Mailbox - Name of Person" has to look like it does in outlook.

and i have a folder called Attachments (not a subfolder of the inbox)

Sub attach()
Set MAPI = Outlook.GetNamespace("MAPI")
Set TopFolder = MAPI.Folders.Item("Mailbox - Name of Person")
Set InboxFolder = TopFolder.Folders.Item("Attachments")

For Each myItem In InboxFolder.Items
For Each att In myItem.Attachments
att.SaveAsFile "C:\attachments\" & att.FileName
myItem.Delete
Next
Next

End Sub

Edited by net_user
  • 4 weeks later...
  • 3 weeks later...
Posted
curious:

1) can this work on exchange?

2) can this apply to specific sender? (i don't want all mails in my inbox to be stripped :))

1.yes, i'm using this in an exchange environment.

2. yes, set up a outlook rule to move emails to a specific folder, and have the vb code run for that specific folder.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...