Excel AddIn for Fixing Links To UDFs In AddIns.
This is essentially a republish of Jan Karel Pieterse’s article https://jkp-ads.com/articles/FixLinks2UDF.asp. So all credits go to him!
The main reason for this repository is to bundle all improvements at one point. Otherwise one has at least to dig through all the comments below the article to find them. And in the meantime a lot of additional features/functionality has been added.
-
Fix links in Workbooks to UDFs in AddIns which paths have changed (this is the main/original feature)
-
allow fixing links also when the extension of the AddIns have changed
-
allow fixing links also on (passwordless) protected Worksheets
-
allow to have a “wrapper” AddIn (named
FixLinks2UDF.xlam
)
ℹ️
|
If you want to to build the AddIn from source, please have a look at How to create the AddIn from source. |
The simplest way to get started is to
-
download the
FixLinks2UDF.xlam
file (from the root folder) and save it to a place of your choice. (The default path for Office AddIns (on Windows) isC:\Users\<user name>\AppData\Roaming\Microsoft\AddIns
which can safely be used.)
-
Start Excel
-
Activate the AddIn
-
by opening the Add-Ins window (e.g. Developer › Add-ins › Excel Add-ins), and
-
adding a checkmark at the
FixLinks2UDF
entry.
-
❗
|
There are several options/functionalities to choose from. To check them out please have a look at AddIn options. |
Now the FixLinks2UDF
AddIn is “listening” and you need to “register” the AddIns, whose UDF links should be fixed.
That is done by
-
opening the Visual Basic Editor (VBE) (Alt+F11),
-
adding the module
FixLinks2UDF_Client.bas
to the AddIn of your choice,-
With Rubberduck:
-
Right-click on the project to which you want to add the module in the “Code Explorer” (to show it press Ctrl+R) and click on Sync Project › Update Components from Files….
-
Select the corresponding file in the src folder and click on Open.
-
-
Without Rubberduck:
-
Select the corresponding file(s) in the src folder (e.g. in the Windows 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.)
-
-
-
adding the line,
FixLinks2UDF_Client.RegisterAddInToFixLinks2UDF
to the
Workbook_Open()
event (in theThisWorkbook
class module (which can be found in the “Microsoft Excel Objects”)), and -
checking, if there are obvious errors by compiling the project (Debug › Compile ‹project name›), and
-
saving the AddIn.
-
Be sure that the AddIn/project you want to save is “active” in the VBE by checking, if its name is shown in the 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 Explorer.
-
Last you need to make sure that the AddIns (whose links should be fixed) are loaded after the FixLinks2UDF
AddIn. This (safely) can be done by
-
opening Excel’s Add-Ins window (e.g. Developer › Add-ins › Excel Add-ins),
-
activating the AddIn
FixLinks2UDF
(it should already be active if you have followed this guide), -
deactivating all AddIns which were modified as specified above, i.e. whose links should be fixed,
-
confirming the selections by pressing the OK button,
-
closing Excel,
-
reopening Excel and the Add-Ins window,
-
activating all AddIns which were modified as specified above, i.e. whose links should be fixed,
-
confirming the selections by pressing the OK button, and
-
closing Excel (again).
ℹ️
|
All the closing and reopening is needed to ensure that it really works. Otherwise there are plenty of pitfalls that can (to the authors experience) easily lead to unexpected results. |
💡
|
If you want to check that there are no obvious errors you can
Hopefully the stated message is clear enough what might be wrong.
For the first cause have a look at the corresponding FAQ entry.
For the second cause most likely the |
If you have followed the instructions given in the How to install / Getting started section, possible “old”/outdated links should be updated automatically upon opening a respective Excel file.
In case you want to first see “FixLinks2UDF” in action before modifying our own AddIns, you can have a look at the tests folder.
There you will find some test AddIns and a test file.
To assure that the test works fine, please check that you first activate the FixLinks2UDF
AddIn and then activate the “test” AddIns!
Unfortunately we don’t know how to create automated tests/unit tests for this project. If you have an idea, we would love to see it! Please add an issue or – even better – a pull request (see the Contributing section).
But of course one can manually test it. Please have a look at the tests folder.
This project is used by (at least) these projects:
If you know more, we will be happy to add them here. In addition it is used by a lot of private, i.e. non-public, Excel AddIns created by the authors.
All contributions are highly welcome!!
If you are new to git/GitHub, please have a look at https://github.com/firstcontributions/first-contributions where you will find a lot of useful information for beginners.
We recently were pointed to https://www.conventionalcommits.org which sounds very promising. We will use them from now on too (and hopefully don’t forget it in a hurry).
-
What are the
'@...
comments good for in the code?You should really have a look at the awesome Rubberduck project!
-
Although the loading order of the AddIns is correct, I (still) get the "!!! …" message(s) in the Immediate Window. What can I do against it?
Then most likely the
FixLinks2UDF
AddIn is blocked by Windows. A quick indicator for that is, that this AddIn isn’t listed in the VBE’s “Code Explorer”/“Project Explorer”. To confirm and fix this suspicion, please have a look at Jan Karel Pieterse’s article: Excel add-ins fail to load