Article ID: 159845 - Last Review: October 10, 2006 - Revision: 1.2 XL97: Parentheses Around Object May Dereference the ObjectThis article was previously published under Q159845 On This PageSYMPTOMS
In Microsoft Excel 97, you may receive a run-time error or unexpected
results from your macro if you enclose the argument for a procedure in
parentheses when a value is not returned from the procedure. You may
receive one of the following error messages:
Run-time error '438': Object doesn't support this property or method
-or-
Run-time error '424': Object Required CAUSE
You may receive one of these error messages if you enclose an object
variable with parentheses when passing the object variable to another
This behavior is by design of Microsoft Excel. RESOLUTION
To correct this problem, do not use parentheses around object variables
that are passed to a function or procedure when a return value is not
expected. Parentheses should only be used around object variables when a
return value is needed.
For example, this line produces an error in Microsoft Excel 97 because the Worksheet object is dereferenced. MORE INFORMATION
This section describes several scenarios where your macro may fail or
behave unexpectedly due to dereferencing of an object variable.
Example 1Example 2Example 3The example below simply demonstrates how you can visualize the difference between an object that is dereferenced and one that is not.REFERENCES
For more information about using parentheses in your macros, click the
Office Assistant in the Visual Basic Editor, type " parentheses," click
Search, and then click to view "Use Parentheses in Code."
NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Excel Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base: 120802
(http://support.microsoft.com/kb/120802/EN-US/
)
Office: How to Add/Remove a Single Office Program or Component
| Article Translations
|

Back to the top
