Types of Dialogs

There are many different ways to display dialog boxes using Visual Basic in Excel, so it is helpful to organize those techniques by starting with the type of dialog box you want to display. The three main sorts of dialog boxes are informational displays, data-entry forms, and other tasks. Table 20-1 organizes the ways to display dialogs based on those types.

Table 20-1. Types of dialogs and how to display them

Type of dialog

Example

Use one of these

See

Informational display

Success message

MsgBox function

Chapter 3

 

Help

Help or FollowHyperLink method

Chapter 6

Data-entry

Enter values in a list

ShowDataForm method

This chapter

 

Advanced data entry

User form

This chapter

Task-specific

Get a value or range

InputBox method

Chapters 3, 7

 

Get a file or folder name

FileDialog, GetOpenFilename, or GetSaveAsFilename method

Chapter 7

 

Show a built-in Excel dialog box

Dialogs method

Chapter 7

 

Set task options or custom properties

User form

This chapter

 

Wizard

User form

This chapter

As you can see from Table 20-1, Excel handles the well-structured tasks for you, but as your needs become open-ended, you need to start creating your own user forms. The lesson from Table 20-1 is to not start with the Forms Designer—look around first to see if Excel already does the work for you!

Get Programming Excel with VBA and .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.