The information in this article applies to:
SYMPTOMS
In the versions of Microsoft Excel listed above, when you copy and paste
code in a Visual Basic procedure that was created with the Macro Recorder,
the pasted code may not behave the way that you expect.
CAUSE
In some cases, the Visual Basic code recorded by the Macro Recorder
contains an extended ASCII character (such as a carriage return or line
break). When you copy and paste this code to another location in a module,
the character is pasted with the normal functionality.
WORKAROUNDTo work around this behavior, edit the recorded procedure and replace the symbol with a Chr(n) function, where "n" is the ASCII character code for the extended character. For example, if the recorded macro appears as follows in the module
where || is the "box" character, edit the line as follows:
NOTE: The value 10 is the ASCII character code for a carriage return.
STATUSMicrosoft has confirmed this to be a problem in the versions of Microsoft Excel listed at the beginning of this article. This problem was corrected in Microsoft Excel 97 for Windows and Microsoft Excel 98 Macintosh Edition. MORE INFORMATIONIn Microsoft Excel, if you enter the text "good" and then press ALT+ENTER and then type the text "guy" in a cell on a worksheet while the macro recorder is running, the code appears as follows in the recorded procedure
where || is a "box" character.
If you copy this line, and paste it to another location in the procedure or module, it appears as follows:
When you run this procedure, you receive the following error message:
If the recorded procedure appears as follows
where || is a "box" character, then pasting this text to another
location results in the following:
You receive a syntax error when you run the procedure that contains this
line.
For more information about character codes, such as the ANSI or ASCII
Character Set, or the Character Set (0-127), choose the Search button in
the Visual Basic Reference and type:
character codesFor more information about the Chr Function, choose the Search button in the Visual Basic Help and type: Chr Additional query words: 5.00a 5.00c 7.00a macro paste chart XL5 XL7
Keywords : kbcode kbprg PgmOthr SynGnrl |
Last Reviewed: October 20, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |