MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Initializing(Loading) Add-ins before Excel Starts

Posted by Rob G on April 02, 2001 11:11 AM

I previously wrote ...

(I am posting again, to try and get Dave's attention...I need your expertise. I have an error message coming up before excel starts to execute any code, so using the Workbook_Open procedure won't be able to help me out. Is there any way to reference the ATP add-in, or install it before excel does its check, in order to alleviate the error message?)

I am having a problem getting rid of an error message. My macro starts using the Auto_Open procedure, which has in it some lines that determine if the 'Analysis Toolpack' and 'Analysis Toolpack - VBA' Add-Ins are installed and if not, then to install them. I use the worksheetfunction command in order to use the Isodd() and Mround() functions in my code. What is happening is that VBA compiles all the code before hitting the Auto_Open procedure, and if the Add-Ins are not installed then an error message appears, before installing my Add-Ins. Is there any way of getting around this? How does Excel initilalize the code? Can I install the Add-ins during the initialization portion of opening the workbook?

Any comments will be greatly appreciated!!

Rob G

Posted by Dave Hawley on April 02, 2001 11:17 AM

Hi Rob

The I only mention the Workbook_Open as this is the prefered method from Excel 97 onwards. I realise that It will not help you directly.

Private Sub Workbook_Open()
AddIns("Analysis ToolPak").Installed = True
AddIns("Analysis ToolPak - VBA").Installed = True
End Sub

This must be placed within the "ThisWorkbook" module.

The text below that I also posted is what should do the trick:

To prevent the early compiling, while in the VBE go to Tools>Options|General and de-select the "Compile on demand" checkBox.


Compile On Demand — Determines whether a project is fully compiled before it starts, or whether code is compiled as needed, allowing the application to start sooner.

Background Compile — Determines whether idle time is used during run time to finish compiling the project in the background. Background Compile can improve run time execution speed. This feature is not available unless Compile on Demand is also selected


OzGrid Business Applications