You have two choices to make the functionality work, i.e. to fix the links to UDFs in AddIns.
Either you create a “wrapper” AddIn named FixLinks2UDF.xlam
that handles the fixes or you use the code “stand-alone” which means that you add the code to each AddIn which UDFs links should be fixed. The former has the benefit that you only have one place to incorporate fixes and/or new features.
-
Open a fresh/new Excel file.
-
Open the Visual Basic Editor (VBE) (Alt+F11).
-
Add the modules and class modules in the src folder (without the files from the
Client
subfolder) to the project.-
With Rubberduck:
-
Right-click on the project to which you want to add the modules in the “Code Explorer” (to show it press Ctrl+R) and click on Add › Existing Files….
-
Select all files in the src folder and click on Open.
-
-
Without Rubberduck:
-
Select all files in the src folder except
ThisWorkbook.doccls
in Windows File Explorer. -
Drag-and-drop them to the corresponding project in VBE’s “Project Explorer”.
(To show it press Ctrl+R. Hit it twice if the Code Explorer shows up first.) -
Open
ThisWorkbook.doccls
in an editor, copy its content, and paste it to theThisWorkbook
class module (which can be found in the “Microsoft Excel Objects”).
-
-
-
Add a reference to the “Microsoft Scripting Runtime” library.
-
With Rubberduck:
-
Right-click somewhere on the project in the Code Explorer and click on Add/Remove References….
-
Type (parts of) the library name in the search box until you see it in below (left) list.
-
Select the library in the (left) list and click on the ➨ button to add it to the project references.
-
Click on the OK button to close the window.
-
-
Without Rubberduck:
-
Open the Reference manager in the VBE (Tools › References…).
-
Add a checkmark to the corresponding library.
-
Click on the OK button to close the window.
-
-
-
Change project name to
FixLinks2UDF
-
With Rubberduck:
-
Right-click on the project to which you added the modules in the Code Explorer,
-
click on Project Properties, and
-
change the “Project Name” accordingly.
-
-
Without Rubberduck:
-
Right-click on the project to which you added the modules in the VBE Project Explorer,
-
click on VBAProject Properties…, and
-
change the “Project Name” accordingly.
-
-
-
Check, if there are obvious errors by compiling the project (Debug › Compile FixLinks2UDF).
-
Save the file/project as
FixLinks2UDF.xlam
.-
In Excel (not the VBE) press the Save button (e.g. in the Quick Access Toolbar),
-
change the “Save as type” value to “Excel Add-in (*.xlam)”,
-
change the “File name” accordingly, and
-
save it in a location of your choice by pressing the Save button. (It is perfectly fine to use the folder that is suggested/shown by Excel when you change the “Save as type” value.)
-
-
Close Excel
-
Activate the AddIn
-
by opening Excel,
-
opening the Add-Ins window (e.g. Developer › Add-ins › Excel Add-ins), and
-
adding a checkmark at the
FixLinks2UDF
entry.
-
-
Run the sub
SetDocumentProperties
in themodDocumentProperties
module.-
Open the VBE (Alt+F11),
-
open the module
modDocumentProperties
(via Code Explorer or Project Explorer), -
place the cursor somewhere in the procedure
SetDocumentProperties
, and -
run that sub (e.g. by pressing F5).
-
-
Open the VBA project, to which you want to add the FixLinks2UDF functionality in the Visual Basic Editor (VBE) (Alt+F11).
-
Add the modules and class modules in the src folder except the
ThisWorkbook.doccls
to the project.-
With Rubberduck:
-
Right-click on the project to which you want to add the modules in the “Code Explorer” (to show it press Ctrl+R) and click on Sync Project › Update Components from Files….
-
Select all files in the src folder except the
ThisWorkbook.doccls
and click on Open. -
Open
ThisWorkbook.doccls
in an editor and merge its content with the (maybe present) content ofThisWorkbook
class module.
-
-
Without Rubberduck:
-
Select all files in the src folder except
ThisWorkbook.doccls
and drag-and-drop it to the corresponding project in VBE’s Project Explorer. -
Open
ThisWorkbook.doccls
in an editor and merge its content with the (maybe present) content ofThisWorkbook
class module (which can be found in the “Microsoft Excel Objects”).
-
-
-
Add a reference to the “Microsoft Scripting Runtime” library.
-
With Rubberduck:
-
Right-click somewhere on the project in the Code Explorer and click on Add/Remove References….
-
Type (parts of) the library name in the search box until you see it in below (left) list.
-
Select the library in the (left) list and click on the ➨ button to add it to the project references.
-
Click on the OK button to close the window.
-
-
Without Rubberduck:
-
Open the Reference manager in the VBE (Tools › References…).
-
Add a checkmark to the corresponding library.
-
Click on the OK button to close the window.
-
-
-
Check, if there are obvious errors by compiling the project (Debug › Compile ‹project name›).
-
Save the AddIn/project.
-
Be sure that the AddIn/project you want to save is “active” in the VBE by checking, if its name is shown in VBE’s title bar.
(If it’s not, open a (class) module of the corresponding AddIn (and close it again).) -
Press the “Save” button (the disc symbol similar to 💾) in VBE’s toolbar.
-
Check that the file (really) was saved by having a look at the “last modified date” of the AddIn file in the Windows File Explorer.
-
-
Close Excel