"Cannot Find" Using Analysis ToolPak Visual Basic Function


The information in this article applies to:


SYMPTOMS

In Microsoft Excel, if you use one of the functions provided in the Analysis ToolPak-Visual Basic for Applications add-in (ATPVBAEN.XLA), such as the EDATE() function, you receive the following error message:

Run-time error '1004':

Cannot find macro '[ATPVBAEN.XLA]REG!reg_EDATE'.
where the name of the function that you use appears in the place of EDATE in the above error message.


CAUSE

This error message appears when you use any of the following Analysis ToolPak functions in a Visual Basic module:


   New Function    Old Function
   ----------------------------

   EDATE           NEWMONTH
   EOMONTH         NEWMONTHE
   CUMIPMT         CUMPI
   TBILLEQ         TBILLYEQ
   TBILLPRICE      TBILLP
   TBILLYIELD      TBILLY 


WORKAROUND

To avoid receiving this error message when you use one of these functions in a Visual Basic procedure, you can do either of the following:

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.

   Sub Test()
      Dim x as Date
      x = Application.ExecuteExcel4Macro("EDATE(datevalue(""1/1/94""),5)")
   End Sub 
NOTE: When you use this method with the EOMONTH() function, the value returned is one day less than the correct value. To avoid this problem, use the workaround below.
-or-


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 for Windows version 5.0c.

Note that in Microsoft Excel version 5.0c, you only receive this error message when you use a function in ATPVBAEN.XLA if the file is not open when you run the procedure that contains the function.


MORE INFORMATION

To view the Visual Basic functions that are included in the Analysis ToolPak-Visual Basic for Applications add-in, do the following:

  1. Open the file ATPVBAEN.XLA (located in the LIBRARY\ANALYSIS subdirectory of the Microsoft Excel directory).


  2. In a Visual Basic module, choose Object Browser from the View menu.


  3. From the Libraries/Workbooks list, select ATPVBAEN.XLA.


The Methods/Properties list contains all of the Visual Basic functions included in the Analysis ToolPak - Visual Basic for Applications add-in.

Additional query words: atp addins err msg

Keywords : xlwin
Version : WINDOWS:5.0
Platform : WINDOWS
Issue type :
Technology :


Last Reviewed: November 2, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.