ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to load an add-in (https://www.excelbanter.com/excel-programming/293605-macro-load-add.html)

Mark Frank

Macro to load an add-in
 
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

Walt Weber

Macro to load an add-in
 
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

-----Original Message-----
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
.



All times are GMT +1. The time now is 03:13 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com