Microsoft KB Archive/284882

= Error when you programmatically retrieve a user name from protected ranges =

Article ID: 284882

Article Last Modified on 5/29/2007

-

APPLIES TO


 * Microsoft Office Excel 2007
 * Microsoft Office Excel 2003
 * Microsoft Excel 2002 Standard Edition

-



This article was previously published under Q284882





SYMPTOMS
You programmatically attempt to retrieve the name of a user who was given access to parts of a protected worksheet in Microsoft Excel. When you do this, you may receive an error message that resembles the following error message:

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  , add the name preceded by the domain:  \ , or the name proceeded by the machine:  \ .



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



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.

Additional query words: XL2002 1004 runtime XL2003 XL2007

Keywords: kbbug kberrmsg kbpending KB284882

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.