Turtleman10
Technical User
When I run this code I get the error that I do not have the apropriate permissions. I am the admin on my machine do I need to set something in outlook also?
Code:
Sub CopyAttachments()
' this is how to save attachments in temprary folder
' objSourceItem = InputBox("SURCE", , , , 8)
' objTargetItem = InputBox("TARGET")
Set objApp = CreateObject("Outlook.Application")
Set objEXP = objApp.ActiveExplorer
Set objSel = objEXP.Selection
Set SRC1 = objSel.Item(1)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldTemp = fso.GetSpecialFolder(2) ' TemporaryFolder
STRPATH = "C:\test"
Dim PATH As String
PATH = "C:\test"
'If Dir(STRPATH & "TMPATCH") = "" Then
'MkDir STRPATH & "TMPATCH"
'End If
'STRPATH = fldTemp.PATH & "\TMPATCH\"
'Set SRC1 = GetCurrentItem()
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