References

You can reference object libraries to make their objects available in your code (Tools > References).
Any references to external object libraries are saved within the individual file.
Before you can use any functions, objects, methods or properties from external object libraries you must add a reference to them first.


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


AddFromFile
AddFromGuid
Remove


For code in one project to call code in another project the calling project must have a reference to the calling project.
This list also includes references to any other object libraries and any ActiveX controls installed on your computer.
This list contains files that have been automatically registered in the Registry will appear automatically.

alt text


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.


However this of course one major disadvantage
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.


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".


MISSING

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).


All the boxes with checks against them denote the Object libraries that are currently available to your project.


Object Browser

Any references you add to your project will automatically get added to the libraries drop down list in the Object Browser.


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

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