Registering a User Defined Function with Excel

Pages in this article

  1. Introduction
  2. How does it work?
  3. Setting things up
  4. Class Module
  5. VBA code
  6. Put to Use
  7. Wrap Up

Setting Things Up

Putting this method to use is fairly simple if one uses the workbook which can be downloaded here.

The workbook uses a table on sheet FunctionList, which all details of all UDFs can be entered:

Screenshot of worksheet table to set function details for the registration
Screenshot of worksheet table to set function details for the registration

Row 7 of this table is prefilled with function names of User32.dll which seem to be rarely used. Of course you can use any other dll here, with its accompanying functions.

Note that the worksheet has been protected (no password was set) to avoid accidental changes to fixed information and that rows 28-65536 are hidden.

The rest of the work is done using some XL4 macro code and some VBA code, as described on the next pages.