MXL5: Run-Time Error '1004' or '1006' Using ATP Function

ID: Q125804

The information in this article applies to:

SYMPTOMS

In Microsoft Excel, when you use one of the Analysis ToolPak worksheet functions, you may receive one of the following error messages:

   Run-time error '1004':
   Run Method of Application class failed

   -or-

   Run-time error '1006':
   Unable to get the ThisWorkbook property of the Application class

CAUSE

These symptoms occur if the workbook that contains the function also contains a module sheet that references the Analysis ToolPak-Visual Basic for Applications add-in file.

The error messages occur when you use one of the following worksheet functions:

   EDATE()
   EOMONTH()
   IMSUM()
   NOMINAL()
   TBILLEQ()
   TBILLPRICE()
   TBILLYIELD()
   GCD()
   LCM()
   MULTINOMIAL()
   IMPRODUCT()
   CUMIPMT()
   CUMPRINC()
   BESSELI()
   BESSELJ()
   BESSELK()
   BESSELY()

You receive the run-time error '1004' if the Analysis ToolPak-Visual Basic for Applications add-in is also loaded (selected in the Add-ins dialog box). If the Analysis ToolPak-Visual Basic for Applications is not loaded, you receive the run-time error '1006.'

Note that this behavior also occurs if you use the FunctionWizard to insert the function.

WORKAROUND

To avoid receiving these error messages when you use one of the Analysis ToolPak worksheet functions, use either of the following methods:

Method 1

Move the Visual Basic module that references the Analysis ToolPak-Visual Basic for Applications file to another workbook that does not contain a worksheet that uses an Analysis ToolPak worksheet function.

Method 2

Clear the Analysis ToolPak check box in the Add-Ins dialog box and restart Microsoft Excel. To do this, use the following steps:

1. On the Tools menu, click Add-Ins, and clear the Analysis ToolPak check

   box.

2. Verify that the Analysis ToolPak--VBA check box is selected, and click
   OK.

3. Save your work if necessary, click Quit on the File menu, and restart
   Microsoft Excel.

NOTE: In order to successfully use the Analysis ToolPak function in the worksheet, you must also click the module sheet,click References on the Tools menu, select Analysis ToolPak--VBA and click OK.

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.

Additional query words: 5.00 addins atp err msg toolpack

Keywords          : kbtool xlmac 
Version           : MACINTOSH: 5.0, 5.0a
Platform          : MACINTOSH
Issue type        : kbbug

Last Reviewed: February 5, 1998