XL: Syntax Error with Recorded ExecuteExcel4Macro MethodLast reviewed: February 3, 1998Article ID: Q110310 |
The information in this article applies to:
SYMPTOMSWhen you record a Microsoft Visual Basic Programming System, Applications Edition macro command, and the ExecuteExcel4Macro method is recorded, you may receive a syntax error when you run the macro.
CAUSEA few commands in Microsoft Excel must be recorded using the ExecuteExcel4Macro method because there is no equivalent command in Visual Basic. If the recorded command uses the ExecuteExcel4Macro method, the command may be placed onto two or more physical lines using the line continuation character (_). For example, the following command is recorded when you change the update option for a link to Manual by clicking Links on the Edit menu:
ExecuteExcel4Macro "SET.UPDATE.STATUS( _ ""Word.Document.6|Document2!!DDE_LINK1"",2,2)"This command will cause a syntax error when you run the macro because the ExecuteExcel4Macro argument is split across lines. Because the ExecuteExcel4Macro argument is a string, it must be contained all on one line.
WORKAROUNDWhen you use the ExecuteExcel4Macro command, type the command all on one line. If you record a macro, and a line continuation character is incorrectly inserted in the ExecuteExcel4Macro command, delete any line continuation characters in the command so that the command is all on one line.
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. NOTE: In all versions of Microsoft Excel, commands that follow the ExecuteExcel4Macro command must always be on a single line.
REFERENCESFor more information about the ExecuteExcel4Macro Method, choose the Search button in Help and type:
Excel 4.0: macro sheets |
Additional query words: 5.00 5.00a 5.00c 7.00 7.00a XL7 XL5
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |