Sei sulla pagina 1di 1

16

Chapter 3

Using Message box and Input box

There are many built-in functions available in Excel VBA which we can use to
streamline our VBA programs. Among them, message box and input box are most
commonly used. These two functions are useful because they make the Excel VBA
macro programs more interactive. The input box allows the user to enter the data
while the message box displays output to the user.

3.1 The MsgBox ( ) Function

The objective of the MsgBox function is to produce a pop-up message box and
prompt the user to click on a command button before he or she can continue. The
code for the message box is as follows:

yourMsg=MsgBox(Prompt, Style Value, Title)

The first argument, Prompt, displays the message in the message box. The Style
Value determines what type of command button that will appear in the message box.
Table 3.1 lists the command button that can be displayed. The Title argument
displays the title of the message box.

Potrebbero piacerti anche