XL5: Macro Fails If Optional Argument Uses Integer Data Type

ID: Q112321


The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0


SYMPTOM



On page 128 in some versions of the "Visual Basic User's Guide," the example that illustrates the REVERSE() function, contains the following line of code:


   Function Reverse (S As String, Optional ByVal n As Integer) 
This code is incorrect. The optional argument "Optional ByVal n As Integer" is incorrect because, as is stated in the paragraphs immediately preceding the function code, all optional arguments must be of the Variant data type.


WORKAROUND

The correct line of code is the following:


   Function Reverse (S As String, Optional ByVal n As Variant) 


STATUS

This problem has been corrected in versions of the "User's Guide" dated later than January 1994.

Additional query words:

Keywords : kbprg
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :


Last Reviewed: October 25, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.