Chapter 9. Extending VBA with APIs

WHAT'S IN THIS CHAPTER?

  • Using the Windows API to add functionality to Access applications

  • Converting API Function Declarations from C++ to VBA

  • Writing API declarations that will work on 32-bit and 64-bit Office 2010, as well as in previous versions of Office

Microsoft Visual Basic for Applications (VBA) is a full-featured software development language that offers a vast array of built-in functions such that many Access developers never require anything else.

However, when you start developing more and more complex applications in Access, you may find yourself needing to do things for which VBA does not have a built-in function. Moreover, you'll sometimes need to do things that VBA simply can't do. That's not to say that VBA is incomplete, but, like every other programming language, it does not include every function you're ever likely to need.

The Windows operating system provides a large library of functions that you can access using VBA to extend what you're able to do in your applications. But because the Application Programming Interface (API) is primarily geared toward C/C++ developers and thereby VBA-unfriendly, you must first understand what it is, and what special considerations you must take into account to use it from VBA.

This chapter explores what the Windows API is, and why you might want to use it. It describes the libraries that make up the API and how to declare API functions to use them with VBA. You'll examine the differences between ...

Get Microsoft® Access® 2010 Programmer's Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.