The Windows API and Other Dynamic-Link Libraries

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

One of the most powerful features of Microsoft® Visual Basic® for Applications (VBA) is its extensibility. You can extend your applications by calling functions in the Microsoft® Windows® application programming interface (API) and other dynamic-link libraries (DLLs). As a VBA programmer, you will find that most of the functions in the Windows API are available to you, meaning not only do you have control over your application, you have potential control over a significant portion of the operating system. In addition, when you have learned how to use VBA to call a DLL function, you can call functions in almost any DLL, so you can take advantage of technologies that are typically the domain of C and C++ programmers.

In This Section

  • API Basics
    The purpose of the Microsoft® Windows® API is to make it possible for you to develop programs consistent with the Windows operating system and user interface.
  • Calling DLL Functions
    Although calling DLL functions is in many ways similar to calling VBA functions, there are differences that might make DLL functions confusing at first.
  • Wrapping DLL Functions
    If you call DLL functions frequently, you might want to simplify the process by encapsulating those functions within class modules.
  • Programming Concepts
    When you program, you store data and manipulate it with a series of instructions. The data and data storage containers are the raw materials of programming.
  • Writing Solid Code
    "Writing solid code" means writing Microsoft® Visual Basic® for Applications (VBA) code or script that performs as expected and is reusable, easy to understand, and easy to maintain.
  • Custom Classes and Objects
    If you have not used class modules to build custom objects before, there are some concepts you must understand to design, build, and use custom objects with their own methods and properties.