Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

VBA-Excel: Reference Libraries in Excel WorkBook.

There are set of built in libraries available in excel, few of them are default to your code and rest are optional to be added. These libraries contain various built in methods, objects and properties for these methods and objects. These libraries act same as namespaces in .Net, packages in Java

Below are the steps for adding reference libraries to y

our Excel workbook

  1. Open Excel workbook and press Alt + F11 to get Visual Basic Editor (VBE)
  2. Go to the Tools menu and select References from the drop down menu.
  3. References- VBAProject” dialog will appear.
Reference Libraries

Reference Libraries

As you can see the list of available references and check box for each reference and you will notice that few check boxes are already checked so these are the default libraries which are already added to you excel.

You can select the check box for any of the library you want to add in your excel and click OK button from the right and you will be able to use the methods and objects which resides in that library.

If you try to use the object for which the necessary library is missing then you will end up getting error

“Compile error: User-defined type not defined”

“Compile error: User-defined type not defined”

Example:

For using MSForms.DataObject in your code you need library “Microsoft Forms 2.0 Object Library

Sometimes you won’t find the desired references in the list, say you won’t find “Microsoft Forms 2.0 Object Library” in the tool/reference list in that case you need to browse the FM20.DLL file from the system32

Browse reference file -  FM.20.DLL

Browse reference file – FM.20.DLL

Once you add the FM20.DLL, you can see the Microsoft Forms 2.0 Object Library” is added to the reference list

Microsoft Forms 2.0 Object library

Microsoft Forms 2.0 Object library

 

You may also like...

2 Responses

  1. Manoj B says:

    Hi Sumit,

    I have gone thro’ most of the chapters that u have written.Its superb & very usefull in my current task ..thanks !

    Currently I am stucked at one point. I want to handle/perform some actions in the Dialog box. In that dialog box ther are many objects like list box,text box etc.

    is ther any way to set the values / perform any actions on these..?

    Thanks..
    Manoj Badgujar
    9766256355

  2. michele says:

    Hi, I’ve used this code for many years, but now that I try with excel2010 and windows10, it dont works anymore. I’ve already checked the presence of Microsoft Forms 2.0 Object Library and it’s ok.
    Any suggest to find solution?

Leave a Reply

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

%d bloggers like this: