Chapter 20. Interacting with Other Applications

In This Chapter

In this chapter, I describe some of the ways in which your Excel applications can interact with other applications. Of course, I also provide several examples.

  • Starting or activating another application from Excel

  • Displaying Windows Control Panel dialog boxes

  • Using Automation to control another application

  • A simple example of using ADO to retrieve data

  • Using SendKeys as a last resort

In the early days of personal computing, interapplication communication was rare. In the pre-multitasking era, users had no choice but to use one program at a time. Interapplication communication was usually limited to importing files; even copying information and pasting it into another application — something that virtually every user now takes for granted — was impossible.

Nowadays, most software is designed to support at least some type of communication with other applications. At the very least, most Windows programs support the Clipboard for copy-and-paste operations between applications. Many Windows products also support Automation.

Starting an Application from Excel

Starting up another application from Excel is often useful. For example, you might want to execute another Microsoft Office application or even a DOS batch file from Excel. Or, as an application developer, you might want to make it easy for a user to access the Windows Control Panel.

Using the VBA Shell function

The VBA Shell function makes launching other programs relatively easy. ...

Get Excel® 2007 Power Programming with VBA 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.