XL2002: Error When You Programmatically Retrieve a User Name from Protected Ranges (284882)



The information in this article applies to:

  • Microsoft Excel 2002, when used with:
    • the operating system: Microsoft Windows 2000
    • the operating system: Microsoft Windows NT 4.0

This article was previously published under Q284882

SYMPTOMS

When you programmatically attempt to retrieve the name of a user who was given access to parts of a protected worksheet, you may receive an error message similar to the following:
Run-time error '1004':
Application-defined or object-defined error.

CAUSE

This problem may occur when all of the following conditions are true:
  • You used the AllowEditRanges property in Microsoft Visual Basic for Applications to add a user to the permissions list of a range on a worksheet.
  • The user name that you added is also a machine name on your computer network.
  • The user name was not fully qualified by using the domain name or the machine name in which the user name resides.
When you attempted to add the user name programmatically to the permissions list of a range on a worksheet, the computer with the same name was actually added instead.

WORKAROUND

To work around this problem, add users by fully qualifying their account with the domain name or the machine name. For example, instead of adding a user named Name, add the name preceded by the domain: Domain\Name, or the name proceeded by the machine: Machine\Name.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Microsoft Windows NT and Microsoft Windows 2000 have Access Control Lists that contain computer, user, and group names. When Excel adds a user to the edit range by using the AllowEditRanges method, Windows NT and Windows 2000 match the text with a valid member in the Access Control List, even if the member is a group name or a computer name. The AllowEditRanges property attempts to add the name of the machine to the account list, which causes a run-time error.

Although the AllowEditRanges property allows you to add machine names to the permissions list, only user permissions and group permissions actually work correctly.

Modification Type:MajorLast Reviewed:11/13/2003
Keywords:kbbug kberrmsg kbpending KB284882