Excel

Install Specific Add-in

Ease of Use

Easy

Version tested with

2000, 2002 

Submitted by:

Justinlabenne

Description:

Used to install a specific add-in that may be necessary for your project 

Discussion:

You may have a project that depends on a certain add-in to be activated so it can be used properly. This code assumes that the add-in is installed on the pc, but will return a message if it cannot be found and activated. 

Code:

instructions for use

			

Option Explicit 'The add-in name to install: 'This name is found in the add-ins dialog 'under tools > add-ins Const mszAddinName As String = "Ref-Mixer" Private Sub Workbook_Open() ' We encounter an error if we attempt to ' install an add-in that is not in the collection On Error GoTo ErrHandle AddIns(mszAddinName).Installed = True MsgBox mszAddinName & " was loaded for use in " & ThisWorkbook.Name Exit Sub ErrHandle: MsgBox "Addin to install was not found", 16 End Sub Private Sub Workbook_BeforeClose(Cancel As Boolean) ' Uninstall the add-in On Error Resume Next AddIns(mszAddinName).Installed = False End Sub

How to use:

  1. Open an Excel Workbook
  2. Copy the code
  3. Right Click on a The top left Excel icon > View Code
  4. Paste code into the right pane
  5. Press Alt+Q to return to Excel
  6. Save workbook before any other changes
 

Test the code:

  1. Open the Excel workbook
  2. If the add-in is loaded, a message will be displayed telling you so
  3. If not, a message will be displayed telling you the add-in cannot be found
 

Sample File:

Add-in test.zip 7.44KB 

Approved by mdmackillop


This entry has been viewed 195 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express