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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can MS-Outlook automatically save incoming attachments to e-mail to C:

Status
Not open for further replies.

delphiman

Programmer
Dec 13, 2001
422
ZA
I need attachments to incoming e-mail to automatically save to c:
I know that MS-Outlook Express provides for one to create "Local folders" to which one can direct incoming e-mail by using Message Rules.

But, depending upon what's in the Subject line, I need certain attachments to save to specific directories on c:\ in the same manner.

Can anyone please tell me whether this is possible?
Where can I get some info on this?

Thanks in advance.
 
You can setup this rule as follows. This rule will look for a specific subject line and then save the entire e-mail (including attachment), to the directory you want.

Launch Outlook | Tools | Rules Wizard
Setup the rule as follows:

Apply this rule after the message arrives
with specific words in the subject
move a copy to the specified folder


specific words and specified are the variables you setup.

Hope that helps

--
Mike

In defeat: unbeatable. In victory: unbearable. -- Winston Churchill
 
Merry Xmas?


Private Sub Application_NewMail()
Dim newMsg As Integer


Set myOlApp = CreateObject("Outlook.Application")
Set myNamespace = myOlApp.GetNamespace("MAPI")
Set myFolder = myNamespace.GetDefaultFolder(olFolderInbox)

c = myFolder.Items.Count

For newMsg = c To 1 Step -1

Set myitem = myFolder.Items(c)
Set myAttachments = myitem.Attachments
If myitem.UnRead = False Then Exit For
If myAttachments.Count > 0 Then


myitem.Display

Set myitem = myOlApp.ActiveInspector.CurrentItem
Set myAttachments = myitem.Attachments
myAttachments.Item(1).SaveAsFile "C:\Outlook Attachments\" & myAttachments.Item(1).DisplayName
myitem.Close olDiscard
Else
Exit Sub
End If
Next newMsg
End Sub
End Sub


[yinyang] Tranpkp [pc2]
 
That was the first / only OL VBA I've ever written, so be gentle but seems to work for me. NOTE doesn't download mult attachments / msg (I didn't need to) But does check multi. new msgs. And will overwrite files automatically. w/o prompting

[yinyang] Tranpkp [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top