XL5: GP Fault Running Macro That Passes Argument to Sub


The information in this article applies to:


SYMPTOMS

In Microsoft Excel, you receive a general protection (GP) fault when you run a Visual Basic procedure that passes an argument to another sub procedure, if the sub procedure closes the workbook that contains the calling procedure.


CAUSE

For example, this problem occurs if you use the following syntax to call the sub procedure "Update" with the argument "1":


   Application.Run "Update(1)" 
-or-

   Application.Run("Update(1)") 
If the procedure Update in the above example closes the workbook that contains the Application.Run command (the calling procedure), you receive a GP fault. The problem occurs whether the procedures are stored in the same workbook, or different workbooks.


WORKAROUND

To avoid receiving a GP fault when you call a sub procedure with an argument, when the sub procedure closes the workbook that contains the calling procedure, use the following syntax to call the sub procedure:


   Application.Run "Update", 1 


STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in Microsoft Excel version 7.0.

Note that in Microsoft Excel version 5.0c, if you use the syntax that causes the problem described above, you do not receive a GP fault, however, the sub procedure may not run as expected.

Additional query words: 1.00 gpf

Keywords :
Version : 5.00 5.00c
Platform : WINDOWS
Issue type :
Technology :


Last Reviewed: March 21, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.