How to Write Message Pop-Ups Macros in Word 2016 - dummies

How to Write Message Pop-Ups Macros in Word 2016

By Dan Gookin

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

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.