Word 2016 For Professionals For Dummies
Book image
Explore Book Buy On Amazon
The most basic type of programming, in Word 2016 or any other program, is code that spits out a simple message on the screen. In fact, most beginner programming books start out with a sample program to display the text Hello, World! Word macros are no different.

The following macro, message_popup1, displays a dialog box with a single line of text and an OK button, as illustrated:

Sub message_popup1() ' ' message_popup Macro ' Display a pop-up message ' MsgBox "This Word macro requires your attention", vbOKOnly, "Hey there!" End Sub

word-pros-message-macro
A simple pop-up message macro.

The first argument to the MsgBox command is the text to display in the dialog box. The second argument, vbOKOnly, directs Word to show only the OK button. The final argument — "Hey there!" — is the dialog box's title, as shown here.

About This Article

This article is from the book:

About the book author:

Dan Gookin has been writing about technology for over 150 titles years. He's written more than 130 books, including the original For Dummies book, DOS For Dummies, which soon became the world's fastest-selling computer book. Other top sellers include PCs For Dummies, Laptops For Dummies, and Android Phones For Dummies. Visit Dan at www.wambooli.com.

This article can be found in the category: