560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Using Excel Add-Ins to Share VBA Code Part four of a four-part series of blogs |
---|
If you've written a killer function, you'll want to be able to share it between workbooks. The best way to do this is using an add-in.
This blog is part of our Excel VBA online tutorial. Wise Owl also run excellent classroom-based VBA courses!
|
The previous parts of this blog show you how to create add-ins; it's time now to use them. To do this, you must link to the add-in.
To add a reference for an add-in that you've created, show the Excel options dialog box:
![]() | ![]() |
Using Excel 2010 | Using Excel 2007 |
You can now go to the Add-Ins dialog box:
To show the Add-Ins dialog box:
In Excel 2010 you can also click on the Add-Ins tool on the Developer tab of the ribbon.
You can now choose the add-in(s) that you want to load:
Tick each add-in that you want to load (here we've ticked WiseOwlCode).
You can now use any of the functions in your add-in within any Excel workbook (this will be true even after you exit Excel and go back in):
Here we've used functions to return people's full names, the path to where files are stored and whether particular worksheets exist or not.
You'll find it easier to get at functions if you use the function wizard:
Click on this tool to insert a function.
You can then select the User Defined category (as shown here) to display a list of all the functions in your add-in:
When you choose User Defined, you can see the functions you've written and shared.
To use a function in an add-in, first include the add-in in Excel (as shown above) , then reference it:
We're writing a module in a new workbook, and our DoesWorksheetExist function doesn't seem to exist.
First go into the References dialog box:
Select Tools --> References from the menu in the VBA code editor.
Now tick the box next to the add-in whose code you want to use:
Tick (in this case) the WiseOwlCode application.
You can now use any code in your referenced add-in:
That's more like it! The DoesWorksheetExist function is in a referenced application.
I'd recommend qualifying the function name with the object library to which it belongs:
If you type in the name of the add-in project, the code completes automatically.
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.