Microsoft Office Tutorials and References
In Depth Information
Working with Code Windows
Figure 7-4: Your first VBA procedure.
To execute the SayHello procedure, make sure that the cursor is located anywhere within the
text that you typed. Then do any of the following:
h Press F5.
h Choose Run ➜ Run Sub/UserForm.
h Click the Run Sub/UserForm button on the Standard toolbar.
If you entered the code correctly, the procedure executes, and you can respond to a simple dialog
box (see Figure 7-5) that displays the username, as listed in the Excel Options dialog box. Notice
that Excel is activated when the macro executes. At this point, it’s not important that you
understand how the code works; that becomes clear later in this chapter and in subsequent chapters.
Figure 7-5: The result of running the procedure in Figure 7-4.