Insert Chart Causes Microsoft Excel to Fail When CSV File Contains Brackets (306656)



The information in this article applies to:

  • Microsoft Office Excel 2003
  • Microsoft Excel 2002
  • Microsoft Excel 2000
  • Microsoft Excel 97 for Windows

This article was previously published under Q306656

SYMPTOMS

If you open a CSV file in Microsoft Excel, and then insert a chart by using the Chart Wizard, Microsoft Excel may unexpectedly fail with an access violation if the CSV file that you opened contains brackets ([ ]) in the name. If you open the CSV file in Microsoft Internet Explorer, the brackets may be added by Internet Explorer when a duplicate item by the same name already exists in the local cache.

The exact error message depends on the version of Microsoft Excel that you are using, and how the chart is added. For example, in Microsoft Excel 2002 or later, a Microsoft Office Dr. Watson dialog box appears, prompting you to restart Microsoft Excel and attempt a recover. However, in Microsoft Excel 97 or 2000, the application fails and Microsoft Windows displays a standard error message for an access violation:
The instruction at "0x3049acca" referenced memory at "0x000000a0". The memory could not be "read".

CAUSE

When you build a chart by using the Microsoft Excel Chart Wizard, you specify a range of data to use for the chart and a chart location. These ranges are qualified with the sheet name. Because CSV files are simple text files (and do not support multiple sheets or unique names), Microsoft Excel uses the file name for the sheet name. However, if this sheet name contains a square bracket (which it does if the file name also has the bracket), Microsoft Excel mistakes the bracket for a range qualifier, which eventually causes Microsoft Excel to fail when it tries to resolve the linked range.

RESOLUTION

Do not use file names for your CSV files that contain square brackets in the name. If you plan to open CSV files in Microsoft Excel from Internet Explorer, consider returning them as attachments, and have the user save them to disk before opening them in Microsoft Excel. Internet Explorer removes the brackets that it uses for cache items when they are saved to disk.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

MORE INFORMATION

Steps to Reproduce This Behavior

  1. Use Notepad (or another text editor) to create a file with the following content:
    name,phone,email
    john,999-555-1010,johng@something.net
    alice,999-555-1011,alice@something.net
    					
  2. Save the file to your local disk hard drive by using a name such as "Test[1].csv."
  3. Double-click the file to open it in Microsoft Excel. (If another program has registered itself for the CSV extension, you can open the file by starting Microsoft Excel from the Start menu, and then browsing to the CSV file from the File menu's Open dialog box.)
  4. When the file is open, select the data that appears. Click Insert, and then click Chart to start the Chart Wizard.
  5. Click Finish. Excel fails before the chart is inserted.

Modification Type:MinorLast Reviewed:7/28/2006
Keywords:kbbug kbpending KB306656