• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Interacting with the User

It is often necessary to have your macros communicate with the user while the macro is running. You may want to display some information or a message to the user, or you may want to ask the user to make a selection or to answer a question. VBA has two simple methods of interacting with the user. The MsgBox function displays messages and receives simple responses from the user. The InputBox function allows you to ask the user a question and provides a text box for the user to enter his or her response.

For applications that require lots of user interaction, you will probably want to develop custom forms using the form design tools provided by the VBE. These tools are discussed in detail in Chapter 31, "Advanced VBA Programming." For simple messages and questions, MsgBox and InputBox are convenient tools for communicating with the user.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint