Article ID: 170308 - Last Review: November 23, 2006 - Revision: 2.4 XL97: User-Defined Function with Application.Run Returns #VALUE!This article was previously published under Q170308 SYMPTOMS
A user-defined Visual Basic for Applications function that carries out the
Run method of the Application object (Application.Run) returns the #VALUE!
error value.
CAUSE
Microsoft Excel enters recalculation mode when a user-defined function is
called from a worksheet cell. While in recalculation mode, Application.Run
is disabled.
RESOLUTION
To correct this problem, install Microsoft Excel 97 Service Release 1
(SR-1).
In Microsoft Excel 97, if you create a function that calls another user- defined function, call the function directly rather than using the Run method. (See the "More Information" section later in this article for sample code that demonstrates calling the function directly.) There is no workaround if the user-defined function calls a function contained in a dynamic-link library (DLL or XLL). You must use Application.Run to call these functions. STATUS
Microsoft has confirmed this to be a problem in Microsoft Excel 97 for
Windows. This problem was corrected in Microsoft Excel 97 SR-1.
For additional information about SR-1, please see the following article in the Microsoft Knowledge Base: 172475
(http://support.microsoft.com/kb/172475/EN-US/
)
OFF97: How to Obtain and Install MS Office 97 SR-1
MORE INFORMATIONMicrosoft 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) You can use the Run method of the Application object to run code written in the Visual Basic or Microsoft Excel 4.0 macro languages. You can also use the Run method to run functions contained in a DLL or XLL. With the exception of functions contained in a DLL or XLL, you can alternatively run functions by calling them directly from within another user-defined function as the following sample demonstrates.
REFERENCES
For more information about user-defined functions, click the Office
Assistant in the Visual Basic Editor, type user-defined function, click
Search, and then click to view "Function Statement".
NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base: 120802
(http://support.microsoft.com/kb/120802/EN-US/
)
Office: How to Add/Remove a Single Office
Program or Component
| Article Translations
|

Back to the top
