Add-In modules vs Code Modules

JenniferMurphy

Well-known Member
Joined
Jul 23, 2011
Messages
2,525
Office Version
  1. 365
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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
If you're using UDFs, Excel will preferentially use the local one rather than one by the same name in an add-in.
 
Upvote 0
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:
Upvote 0
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.
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,744
Members
448,989
Latest member
mariah3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top