XL97: Page Fault Opening Workbook with a Merged Column

ID: Q168362

The information in this article applies to:

SYMPTOMS

When you open a workbook in Microsoft Excel 97, you may receive the following error message:

   This program has performed an illegal operation and will be shut down.
   If the problem persists, contact the program vendor.

If you click Details, you receive an error message similar to the following:

   EXCEL caused an invalid page fault in module EXCEL.EXE at
   0137:301e2e4f.

CAUSE

This problem may occur if you select at least one entire column in a worksheet in the workbook and merge the cells into a single cell by clicking Merge Cells.

RESOLUTION

To prevent this problem from occurring, do not merge an entire column (or columns) of cells into a single cell.

Microsoft provides examples of Visual Basic for Applications procedures for illustration only, without warranty either expressed or implied, including, but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The Visual Basic procedures in this article are provided 'as is' and Microsoft does not guarantee that they can be used in all situations. While Microsoft support professionals can help explain the functionality of a particular macro, they will not modify these examples to provide added functionality, nor will they help you construct macros to meet your specific needs. If you have limited programming experience, you may want to consult one of the Microsoft Solution Providers. Solution Providers offer a wide range of fee-based services, including creating custom macros. For more information about Microsoft Solution Providers, call Microsoft Customer Information Service at (800) 426-9400.

To work around this problem, use the following Visual Basic for Applications macro to unmerge all of the cells in the workbook before the invalid page fault occurs:

   Sub UnMergeAllCellsInWorkbook()

       Workbooks.Open FileName:="Test.xls"
       For Each xSheet In ActiveWorkbook.Worksheets
           xSheet.Range("A:IV").UnMerge
       Next xSheet

   End Sub

In the second line of the macro, substitute the name of the workbook for "Test.xls." When you run this macro, Microsoft Excel 97 opens the workbook and unmerges all cells in every worksheet in the workbook. After the macro is finished, you can remerge cells that should remain merged, and then save the workbook.

NOTE: Because the invalid page fault may occur very quickly, the macro doesn't find the exact cause of the problem. Instead, it simply unmerges all of the cells in the workbook.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article.

MORE INFORMATION

In Microsoft Excel 97, you can merge cells by clicking Merge Cells. This button, which is not visible in Microsoft Excel 97 by default, may be displayed by performing the following steps:

1. On the Tools menu, click Customize. Then, click the Commands tab.

2. In the Categories list, click Format. Then, scroll down the Command

   list until you see Merge Cells.

3. Drag the Merge Cells button from the Commands list next to a button on
   an existing toolbar.

4. Click Close.

If you select an entire column (or columns) of cells, and then click Merge Cells to merge the entire column into a single cell, you may receive the error message in this article when you reopen the workbook.

Note that the problem does not occur if you select the Merge Cells check box in the Alignment tab of the Format Cells dialog box to merge the cells. The problem does not occur if you merge all cells in a column except one (for example, you merge A1:A65535).

Additional query words: XL97

Keywords          : kberrmsg xlloadsave xlvbahowto xlformat 
Version           : 97
Platform          : WINDOWS
Issue type        : kbprb

Last Reviewed: May 17, 1999