Microsoft KB Archive/96924

= Microsoft Knowledge Base =

Excel Err Msg: &quot;That Name Is Not Valid&quot; with CHART.WIZARD
Last reviewed: September 12, 1996

Article ID: Q96924

The information in this article applies to:


 * Microsoft Excel for Windows, version 4.0
 * Microsoft Excel for the Macintosh, version 4.0

SUMMARY
In Microsoft Excel version 4.0, when you run a macro that contains the CHART.WIZARD command, if the filename contained in the reference has a space or a dash, you will receive the error message &quot;That Name is Not Valid,&quot; and the macro will halt.

NOTE: If you are using Microsoft Excel for the Macintosh, the error message will be: &quot;Name is not defined.&quot;

To work around this problem, enclose the filename in single quotation marks or remove the filename from the reference entirely.

MORE INFORMATION
Ref, the second argument in the CHART.WIZARD command, specifies the range of cells that contain the source data for the chart. If you manually enter the CHART.WIZARD command, in most cases you will omit the filename reference and use the RC reference with quotation marks, such as &quot;R1C1:R4C1&quot;, or A1 notation, such as !A1:A4 -- both of these examples refer to cells A1:A4 on your active worksheet.

In Microsoft Excel for Windows, you can have a space in a filename if your worksheet is bound in a workbook and you have modified the filename using the options button. In Microsoft Excel for Macintosh,spaces are allowable in any file name.

However, when you record a macro to creates a chart with the chart wizard tool, the full filename is included in the ref argument of CHART.WIZARD. If your filename contains a space, your macro will stop when you try to run it.

STATUS
Microsoft has confirmed this to be a problem in Microsoft Excel versions 4.0 for Windows and the Macintosh. This problem was corrected in Microsoft Excel version 4.0a for Windows. If you are using Microsoft Excel for the Macintosh, you must use one of the workarounds described in this article.

WORKAROUND
To work around this problem, make one of the following changes to the CHART.WIZARD command on your macro sheet:

  Enclose the filename portion of the reference in single quotation marks: For a Windows or Macintosh workbook filename, the second argument in the CHART.WIZARD command will appear as follows: &quot;[BOOK1.XLW]my file!R1C1:R4C1&quot;

Inserting single quotation marks between the first quotation mark and bracket, and between the &quot;e&quot; in file and the exclamation point, as follows, will resolve the problem:

&quot;'[BOOK1.XLW]my file'!R1C1:R4C1&quot;

For a normal Macintosh worksheet, you would need to change the filename reference from:

&quot;my file!R1C1:R4C1&quot;

to

&quot;'my file'!R1C1:R4C1&quot;

-or-   You can omit the filename and use one of the following two styles of cell referencing: &quot;R1C1:R4C1&quot; -or- !A1:A4 Note: The quotation marks must be used with RC notation to indicate that the reference is on the active worksheet. In A1 notation, this reference is indicated with an exclamation point. 