I wrote the following Excel macro to assign user permissions to Excel files.
Sub Add_Permission()
Dim objUserPerm As Office.UserPermission
Set objUserPerm = ActiveWorkbook.Permission.Add("[email protected]", msoPermissionChange)
Application.DisplayAlerts = False
Application.EnableEvents = False
ActiveWorkbook.SaveAs Filename:= _
"C:UsersAdminDesktop" + "order_id_1" + "output_file.xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
Application.DisplayAlerts = True
Application.EnableEvents = True
End Sub
I have run this macro for months without any issue with a university Office account. Recently, I purchased a Microsoft 365 Business Premium license for a new account. I am the only user in the organization.
After logging 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 do not believe the issue is with VBA code since the macro was/is working with another authenticated account. I believe this might be related to some kind of Azure Rights Management settings or similar. I am not familiar with the Azure Information Protection tools, I simply need to allow the macro execution.
Any lead on how I could solve this?
I have tried to set up Information Protection Sensitivity Labels and Policies multiple times but still the same issue.
I have read multiple times the Microsoft documentation but it’s extremely difficult to understand and could not find any solution to my problem.
I am having doubts my Office license is not enough and I might have to purchase an E3 or E5 but by comparing the plans it does not seem to be the case.
dec_psg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.