I may be wrong and I'm not an expert on access permissions, but isn't the Permission Object only valid / initialized for shared files?
Andreas.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I wrote the following Excel Macro to assign user permission to the Excel file.
Sub Add_Permission()
Dim objUserPerm As Office.UserPermission
Set objUserPerm = ActiveWorkbook.Permission.Add("test@test.com", msoPermissionChange)
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:= _
"C:\Users\Admin\Desktop\" + "order_id_1" + "output_file.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
I have run this macro for moths without any issue, but when I purchased a Microsoft 365 Business Premium license for a new account and logged into Excel with that, I am not able to run the macro anymore. On execution it gives the following error:
Run-time error '-2147023727 (80070491)':
Method 'Add' of object 'Permission' failed
I have searched online for weeks but I cannot find any leads to solve this issue. Did someone experience this?
Thank you.
I may be wrong and I'm not an expert on access permissions, but isn't the Permission Object only valid / initialized for shared files?
Andreas.