Hi,
this is a crossed post from:
https://www.excelforum.com/outlook-...s/1186116-save-only-attachments-with-doc.html
There is no answer so I am trying here.
My macro is:
Hi Guys,
my macro is :
Where is a bold text there --> if is checking if oAttachment has word document ("*.doc").
and if it is in e-mail only the doc attachment should be saved into folder. But problem is that all attachments are saved,
how can i change that ?
Please help,
Jacek
this is a crossed post from:
https://www.excelforum.com/outlook-...s/1186116-save-only-attachments-with-doc.html
There is no answer so I am trying here.
My macro is:
Hi Guys,
my macro is :
Code:
Public WithEvents FolderItems As Outlook.Items
Private Sub Application_Startup()
Set FolderItems = Session.GetDefaultFolder(olFolderInbox).Folders("FolderTest").Items
End Sub
Private Sub FolderItems_ItemAdd(ByVal Item As Object)
On Error Resume Next
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
Dim myDestFolder As Outlook.Folder
Set myDestFolder = Outlook.Session.GetDefaultFolder(olFolderInbox).Folders("FolderTest").Folders("processed")
sSaveFolder = "C:\temp"
[B]For Each oAttachment In Item.Attachments[/B]
[B] If oAttachment.DisplayName Like "*.doc" Then[/B]
[B] oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName[/B]
[B] End If[/B]
[B]Next[/B]
Item.Move myDestFolder
End Sub
Where is a bold text there --> if is checking if oAttachment has word document ("*.doc").
and if it is in e-mail only the doc attachment should be saved into folder. But problem is that all attachments are saved,
how can i change that ?
Please help,
Jacek