Macro to load an add-in

M

Mark Frank

Does anyone have an example of a macro to load an add-in
to Excel?

I have an ActiveX script which Creates an Excel
Application object, but in doing so, eliminates the Add-
ins I have saved. I need these add-ins to do some work.

Thanks,

Mark
 
W

Walt Weber

Hi Mark,

Try this:
sub auto_open()
On Error Resume Next 'LOAD & TEST SUCCESS OF LOAD
OF ANALYSIS TOOLPAC
AddIns("Analysis ToolPak").Installed = True
If AddIns("Analysis ToolPak").Installed = False Then
MsgBox "Excel's Analysis ToolPac could not be
loaded." & Chr(13) & _
"This usually means that Excel was installed
with the default settings." _
& Chr(13) & "The Analysis ToolPac includes some
spreadsheet functions used by this application." _
& Chr(13) & "To remedy the situation, it will be
necessary to load the Analysis ToolPac" _
& Chr(13) & "via the Excel installation process
(Select Custom)." & Chr(13) & _
Chr(13) & "This application will close now."
ThisWorkbook.Saved = True
Application.Quit
End
End If
On Error GoTo 0

<Any other auto_open code here

end sub

This code can also wirk within:
Private Sub Workbook_Open()
<The code here
End Sub

Best Regards,
Walt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top