Turtleman10
Technical User
How come when I add the code in this macro to my application I get errors?
Code:
Sub CopyAttachments()
Set objApp = CreateObject("Outlook.Application")
Set objEXP = objApp.ActiveExplorer
Set objSel = objEXP.Selection
Set SRC1 = objSel.Item(1)
Set fso = CreateObject("Scripting.FileSystemObject")
Dim PATH As String
PATH = "C:\test\"
For Each ITEM2 In objSel
Set myAttachments = ITEM2.Attachments
If myAttachments.Count > 0 Then
For i = 1 To myAttachments.Count
myAttachments(i).SaveAsFile PATH & _
myAttachments(i).DisplayName
Next
End If
Next
End Sub