20.3. Using the Win32 Registry APIs

This section describes the Win32 Registry API functions you can use to access and manipulate a wider range of Registry keys than you can with the built-in VBA functions. Before attempting this section, however, we strongly advise that you read Chapter 14.

The Win32 API provides all the functions you need to access the Registry. Of course, the scope of some functions is restricted for purely commonsense reasons; after all, there is little point in making changes to the temporary areas.

But, this begs the question: Where do you find information about all these constants and functions? Welcome to the wonderful world of programming! Unfortunately, Microsoft has not published a definitive text on the Registry, or indeed the Win32 API, so you need to rely on the various books, Web pages, and third-party software utilities that deal with these topics.

This section provides a real-world example of how to use the Registry API functions. For example, if you wanted to add your company name under the HKEY_CURRENT_USER\Software key instead of storing Registry settings under Software\VB and VBA Program Settings, you could use the Registry APIs to do so. Appendix I makes available a complete list of all Registry functions, along with declarations of the Registry-related constants and user-defined types.

To make sense of all the information presented in the preceding sections, you need to see how the Registry APIs are used. To do that, you'll create a module ...

Get Access™ 2007 VBA 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.