Windows API examples

Before you can use a Windows API function, you must declare the function at the top of your code module. If the code module is not a standard VBA module (that is, it's a code module for a UserForm, Sheet, or ThisWorkbook), you must declare the API function as Private.

Declaring an API function is a bit tricky; it must be declared precisely. The declaration statement tells VBA:

♦ Which API function you're using

♦ In which library the API function is located

♦ The API function's arguments

After you declare an API function, you can use it in your VBA code.

I discuss add-ins in Chapter 21.

Was this article helpful?

+2 0

Responses

Post a comment