Create Macros in Microsoft Word

Q

How to create a macro in Microsoft Word? I want to learn how to do things in my Word document with VBScript code.

✍: FYIcenter.com

A

Creating a new macro in Microsoft Word can be done with these steps:

1. Click "Developer" > "Macros". You see the macros management screen.
Microsoft Word - Manage Macros

2. Enter "Hello" as the new macro name and click "Create" button. You see the "Microsoft Visual Basic for Applications" screen.

3. Enter the following code in the Code area:

Sub Hello()
  ok = MsgBox("Hello World!", vbOKOnly)
End Sub

4. Click "Run" icon to test the code. Then close the Visual Basic screen.

You new macro "Hello" is ready to run in any document.
Microsoft Word - VBScript Code as Macro

 

Using Macros in Microsoft Word

⇒⇒MS Word - Frequently Asked Questions

2016-06-25, 1550👍, 0💬