Article ID: 158638 - Last Review: November 23, 2006 - Revision: 2.4 XL97: ApplyNames Method May Cause Invalid Page FaultThis article was previously published under Q158638 SYMPTOMS
When you run a Visual Basic for Applications macro 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.
EXCEL caused an invalid page fault in module EXCEL.EXE at 014f:3026787c. CAUSE
This problem occurs when the following conditions are true:
RESOLUTIONMicrosoft provides programming examples 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. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites: Microsoft Certified Partners - https://partner.microsoft.com/global/30000104 (https://partner.microsoft.com/global/30000104) Microsoft Advisory Services - http://support.microsoft.com/gp/advisoryservice (http://support.microsoft.com/gp/advisoryservice) For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMS (http://support.microsoft.com/default.aspx?scid=fh;en-us;cntactms) To prevent this problem from occurring, do not apply names that do not exist in the active workbook. One method for doing this in a Visual Basic macro is to loop through the array of defined names before you use the ApplyNames method. Then, verify that at least one of the names exists. To do this, create the following macro: STATUSMicrosoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.
This problem no longer occurs in Microsoft Excel 2000.
MORE INFORMATION
In a Visual Basic for Applications macro, you can use the ApplyNames method
to apply names to a range of cells that contain formulas. For example, if
the defined name "Alpha" (without the quotation marks) refers to cell A1 in
a worksheet, and cell B5 contains the formula "=$A$1" (without the
quotation marks), you can use the ApplyNames method to automatically change
the formula to "=Alpha" (without the quotation marks). For example, use the
following sample line of code:
You can apply more than one name at a time by creating an array of defined names. For example, use the following sample line of code to create an array: | Article Translations
|

Back to the top
