XL: MS Excel Hangs When You Set Options for Custom Function

Last reviewed: September 13, 1996
Article ID: Q134611
The information in this article applies to:
  • Microsoft Excel for Windows, version 5.0c
  • Microsoft Excel for Windows 95, version 7.0

SYMPTOMS

In Microsoft Excel, you will receive an Invalid Page Fault error or a general protection (GP) fault if you attempt to set options for a user- defined function that accepts variables of a user-defined type.

CAUSE

This error will only occur if both of the following conditions are true:

  • The user-defined function accepts variables of a specified type. For example, the following function accepts a "NewType" type variable:

          Function Test(X As NewType)
    
             Test = "Hello"
          End Function
    
       NOTE: The problem will not occur if the function accepts variables
       of any type or if it does not accept variables at all.
    
       -and-
    
    
  • The type of the variable being accepted by the function is a user- defined type. Any type NOT included in the following list is a user- defined type:

          Boolean   Integer
          Long      Single
          Double    Currency
          Date      Object
          String    Variant
    
    
If both of these conditions are true, attempting to set options for the function through the Object Browser dialog box may result in an Invalid Page Fault or a GP fault.

WORKAROUND

To prevent this error from occurring, remove all variables from the user- defined function and then set the options for the function. Once the options have been set for the user-defined function, you can then add the variables back into the function.

For example, if your user-defined function reads as follows

   Function Test(X As Integer, Y As NewType)
      Test = X * Y
   End Function

remove the variables from the function declaration line, so that it resembles the following example:

   Function Test()

Then, set the options for the function by following these steps:

  1. On the View menu, click Object Browser.

  2. In the Methods/Properties list, click the name of the function.

  3. click Options.

Once the options are set, add the variables back into the function:

   Function Test(X As Integer, Y As NewType)

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.


KBCategory: kbprb
KBSubcategory:

Additional reference words: 7.00 5.00c vba.dll vba32.dll udf



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 13, 1996
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.