Home

How to Write Message Pop-Ups Macros in Word 2016

|
Updated:  
2016-11-16 3:57:33
|
Word 2010 For Dummies
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 20 years. He has contributed articles to numerous high-tech magazines and written more than 90 books about personal computing technology, many of them accurate.
He combines his love of writing with his interest in technology to create books that are informative and entertaining, but not boring. Having sold more than 14 million titles translated into more than 30 languages, Dan can attest that his method of crafting computer tomes does seem to work.
Perhaps Dan’s most famous title is the original DOS For Dummies, published in 1991. It became the world’s fastest-selling computer book, at one time moving more copies per week than the New York Times number-one best seller (although, because it’s a reference book, it could not be listed on the NYT best seller list). That book spawned the entire line of For Dummies books, which remains a publishing phenomenon to this day.
Dan’s most recent titles include PCs For Dummies, 9th Edition; Buying a Computer For Dummies, 2005 Edition; Troubleshooting Your PC For Dummies; Dan Gookin’s Naked Windows XP; and Dan Gookin’s Naked Office. He publishes a free weekly computer newsletter, “Weekly Wambooli Salad,” and also maintains the vast and helpful Web site www.wambooli.com.