O'Reilly logo

Excel 2003 VBA Programmer's Reference by Robert Rosenberg, Rob Bovey, John Green, Stephen Bullen, Paul T. Kimmel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

16

Programming with the Windows API

Visual Basic for Applications is a high-level language that provides us with a rich, powerful, yet quite simple set of functionality for controlling the Office suite of products, as well as many other applications. We are insulated, some would say protected, from the “mundane minutiae” of Windows programming that a C++ programmer has to contend with.

The price we pay for this protection is an inability to investigate and control many elements of the Windows platform. We can, for example, use Application.International to read most of the Windows Regional Settings and read the screen dimensions from Application.UsableWidth and Application.UsableHeight, but that's about it. All the Windows-related items available to us are properties of the Application object and are listed in Appendix A.

The Windows platform includes a vast amount of low-level functionality that is not normally accessible from VBA, from identifying the system colors to creating a temporary file. Some of the functionality has been exposed in VBA but only to a limited extent, such as creating and using an Internet connection (for example, we can open a page from the Internet using Workbooks.Open “<URL>”, but we can't just download it to disk). There are also a number of other object libraries typically available on a Windows computer that provide high-level, VBA-friendly access to the underlying Windows functionality. Examples of these are the Windows Scripting Runtime and the Internet ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required