How to install fonts with VBA

If you are working with custom fonts within Excel, you may want to install them automatically on a user’s machine, before they start using your workbook. This can be handled in VBA using the following class:

Create a new class module in your workbook and call it clsFontInstall, and then copy and paste the code below into your new class:

To use the class, you can copy and paste the code below into the ThisWorkbook code module, so that the installation happens when the workbook is first opened. Make sure you change the name of the font and location of the font file to whatever font you are working with!

Thank you for reading this post. Please take time to read the disclaimer about content found on this site.

Share :Facebooktwitterredditpinterestmail

2 thoughts on “How to install fonts with VBA”

  1. and I get an error.

    compile error:
    the code in this project must be updated for use on 64-bit systems. Please review and update Declare statements and then mark them with the ptrSafe attribute.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.