Access Error: You dont have appropriate permission to perform this operation (1 Viewer)

fernando.rosales

Registered User.
Local time
Today, 02:55
Joined
Jun 11, 2014
Messages
27
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
 

MarkK

bit cruncher
Local time
Today, 02:55
Joined
Mar 17, 2004
Messages
8,199
This problem is with Windows, not VBA. The user account that is running Access doesn't have authorization to write a file to that folder. You need to widen that folder's permissions in Windows.
 

Users who are viewing this thread

Top Bottom