XL97: Syntax Error Running Macro That Inserts WordArt

Last reviewed: February 12, 1998
Article ID: Q166760
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

In Microsoft Excel 97, if you insert a WordArt object while you are recording a Visual Basic for Applications macro, and then run the macro, the following error message may appear:

   Compile error:
   Syntax error

CAUSE

This problem may occur if the text in the WordArt object you insert contains any quotation marks. When you record the commands to create this kind of WordArt object, Microsoft Excel 97 may not insert the correct combination of quotation marks in the recorded code, and the macro does not work.

For example, if you record the steps to create a WordArt object that contains the following text

   We're the "Wright" Solution!

the recorded code may look similar to the following:

   ActiveSheet.Shapes.AddTextEffect(msoTextEffect3, _
      "We're the "Wright" Solution!", "Arial", 18.00, msoFalse, _
      msoFalse, 69.75, 166.50).Select

Note that the word "Wright" is enclosed in quotation marks.

RESOLUTION

To resolve this problem, add an additional set of quotation marks around the text that you want to appear in quotation marks. For example, change the example code to the following:

   ActiveSheet.Shapes.AddTextEffect(msoTextEffect3, _
      "We're the ""Wright"" Solution!", "Arial", 18.00, msoFalse, _
      msoFalse, 69.75, 166.50).Select

Note the second set of quotation marks around the word "Wright."

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


Additional query words: XL97
Keywords : xldraw xlvbahowto xlvbainfo kberrmsg kbprg
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: February 12, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.