References

It is possible to add external libraries to your VBA projects, to access additional functionality.
You can see which libraries are being used using (Tools > References).
References to external object libraries are saved with the actual file (workbook, document etc), they are not general settings.

The core VBA libraries "Visual Basic for Applications" and the "Application Specific Object Library" cannot be removed.
This list will include any object libraries or ActiveX controls that are installed on your computer.
All the boxes with checks against them indicate that these object libraries are currently available to your project.


Object Browser

Once a reference has been added it will be automatically added to the libraries drop down list in the Object Browser
SS
These objects, methods and properties will all be displayed in the object browser.


MISSING

If you try and run an application on a computer that does not have all the external object libraries installed you will get a compile-time error which cannot be trapped using normal methods.
If any of the references are missing then it will not find any references
SS
You can browse for object libraries (.olb and .tlb) or executables (.exe and .dll). Sometimes you can find you have "Missing" references.
Assuming that it is not required deselect it and choose (Debug > Compile Project).




Early Binding

we are binding the external object library to our application at design-time
Using early binding gives the following benefits:

  • The code is much faster, as all the links between the libraries have already been checked and compiled.

  • The New operator can be used to create instances of the external objects.

  • All of the constants defined in the object library can be utilised therefore avoiding magic numbers.

  • Excel displays the Auto List Members, Auto Quick Info and Auto Data Tips information for the objects while the application is being developed.


Late Binding

If the reference is not listed you can select the "Browse" button to add an additional file.
If the library isn't listed then it is flagged as "MISSING".



Common Functions


Function NameDescription
URLDownloadFileDownloads bits from the internet and saves them as a file
FindWindowRetrieves a handle to the top level window with a specific class name
SetWindowLongChanges an attribute of a specified window
DrawMenuBarRedraws the menubar on a specified window
GetWindowLongRetrieves information about a specified window

If you plan to control other programs from your Office application you will have to add the necessary reference.


AddFromFile
AddFromGuid
Remove


© 2025 Better Solutions Limited. All Rights Reserved. © 2025 Better Solutions Limited TopPrevNext