Excel VBA Error with user access Permission.Add RRS feed

  • Question

  • Hello,

    I wrote an excel macro in VBA to split out a file by specific business segments. Each segment is restricted to users only affiliated with their specific segment. The macro uses the code below to add the email address of workers to the appropriate file breakout for their segment.

    The macro was working as expected for a few months, now when I run the macro I receive an error; "Run-time error '-2147023727 (80070491)': Method 'Add' of object 'Permission' failed".

    The code was never changed, concerned one of my settings might have been adjusted. Is there any guidance here that might help remedy this error? Also, is there a limit to the number of email address that can be added to a restricted workbook?

    Existing VBA Code:

        Dim irmPermission As Office.Permission


        Dim objUserPerm As Office.UserPermission

            Set objUserPerm = ActiveWorkbook.Permission.Add( _

            "", _


             Set objUserPerm = Nothing

    Thursday, August 6, 2020 3:00 PM