PDA

View Full Version : Access Error: You dont have appropriate permission to perform this operation



febrero127
02-20-2015, 09:50 AM
:banghead:
I am having trouble saving an outlook attachment to a folder using VBA. It was working before when I was saving it to a network drive folder but now I want it to save to my documents folder and I am getting an error that says:

Run time error '-2147024891 (80070005)':
Cannot save the attachment. You don't have the appropriate permission to perform this operation.


Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim saveFolder As String
Dim dte As Date
Dim m As String
Dim d As String
Dim y As String


saveFolder = "C:\Users\495170\Documents\Daily Aged Memo auto-send"
dte = Now
m = month(dte)
d = Day(dte)
y = Year(dte)


For Each objAtt In itm.Attachments
objAtt.DisplayName = "Daily Aged Memo - " & m & "-" & d & "-" & y & ".xls"
objAtt.SaveAsFile saveFolder & "\" & objAtt.DisplayName
Set objAtt = Nothing
Next
End Sub

skatonni
02-22-2015, 08:09 AM
Is it Documents or MyDocuments?

Since you have not mentioned any troubleshooting.
Can you open the folder by pasting the path, without quotes, into the address bar of Windows Explorer?


Can you save a document manually?