VBA functions that do more than return a value

A few VBA functions go above and beyond the call of duty. Rather than simply return a value, these functions have some useful side effects. Table 9-1 lists them.

Table 9-1 Functions with Useful Side Benefits

Function

What It Does

MsgBox

Displays a handy dialog box containing a message and buttons.

The function returns a code that identifies which button the user

clicks. See Chapter 15 for details.

InputBox

Displays a simple dialog box that asks the user for some input. The function returns whatever the user enters into the dialog box. I discuss this in Chapter 15.

Function

What It Does

Shell

Executes another program. The function returns the task ID

(a unique identifier) of the other program (or an error if the

function can't start the other program).

0 0

Post a comment