Add-In modules vs Code Modules

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
1,338
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
Is there a way to have an add-in module deactivated for one workbook, but still active for all other workbooks?

The only way I know of to deactivate an add-in is File | Options | Add-Ins | Manage | uncheck the add-in in the list. This procedure causes that add-in to unchecked for all workbooks.

I am trying to convert a workbook from one that uses code in an add-in to a self-contained workbook that I can send to someone else without sending the add-in. I am doing this by copying all of the functions that it uses from the add-in to a code module in the workbook. While I am doing it, which may involve some testing, it would be handy to have the add-in active for any other workbooks that I may have open so they are still functional.

Thanks
 

Some videos you may like

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple

shg

MrExcel MVP
Joined
May 7, 2008
Messages
21,769
Office Version
  1. 2010
Platform
  1. Windows
If you're using UDFs, Excel will preferentially use the local one rather than one by the same name in an add-in.
 

Yongle

Well-known Member
Joined
Mar 11, 2015
Messages
6,705
Office Version
  1. 365
Platform
  1. Windows
To Unload AddIn
Code:
AddIns("Name of AddIn").Installed = False

To Load AddIn when required
Code:
AddIns("Name of AddIn").Installed = True

Suggest you try calling above from workbook event macros
(which should be placed in the workbook where the AddIn is to be disabled)

call unload from
Workbook_Open

Workbook_Activate

call load from
Workbook_BeforeClose
Workbook_Deactivate

Perhaps a single procedure like this
Code:
Sub LoadAddins(TrueFalse As Boolean)
    AddIns("Name of AddIn").Installed = TrueFalse
End Sub

Load with
Code:
Call LoadAddins(True)

Unload with
Code:
Call LoadAddins(False)
 
Last edited:

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
1,338
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
If you're using UDFs, Excel will preferentially use the local one rather than one by the same name in an add-in.

I sorta knew that, but remembered having some problems being sure that it worked that way. Thanks for the confirmation.
 

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
1,338
Office Version
  1. 365
  2. 2016
  3. 2007
Platform
  1. Windows
To Unload AddIn
Code:
AddIns("Name of AddIn").Installed = False

To Load AddIn when required
Code:
AddIns("Name of AddIn").Installed = True

Suggest you try calling above from workbook event macros
(which should be placed in the workbook where the AddIn is to be disabled)

call unload from
Workbook_Open

Workbook_Activate

call load from
Workbook_BeforeClose
Workbook_Deactivate

Perhaps a single procedure like this
Code:
Sub LoadAddins(TrueFalse As Boolean)
    AddIns("Name of AddIn").Installed = TrueFalse
End Sub

Load with
Code:
Call LoadAddins(True)

Unload with
Code:
Call LoadAddins(False)

Thank you very much for this. I will give it a try.
 

Watch MrExcel Video

Forum statistics

Threads
1,108,614
Messages
5,523,919
Members
409,542
Latest member
Shezz01

This Week's Hot Topics

Top