Displaying Excels BuiltIn Dialog Boxes

Code that you write in VBA can execute Excel's menu commands. And, if the command leads to a dialog box, your code can "make choices" in the dialog box (although the dialog box itself isn't displayed). For example, the following VBA statement is equivalent to choosing the Edit ^ Go To command, specifying range A1:C3, and clicking OK. But the Go To dialog box never appears (which is what you want).

Application.Goto Reference:=Range("A1:C3")

In some cases, however, you may want to display one of Excel's built-in dialog boxes so that the end user can make the choices. There are two ways to do this:

♦ Access the Dialogs collection of the Application object.

♦ Execute a menu item directly.

I discuss each of these techniques in the sections that follow.

Was this article helpful?

0 0

Post a comment