

VBA will automatically add the parenthesis and End Sub. To create a procedure in VBA type “Sub WordMacroExample” (Where “WordMacroExample” is your desired Macro name) and press ENTER.

It performs the following tasks:Īll VBA code must be stored within procedures like this. This is a simple example of a Word VBA Macro. To access the VBA Editor use the shortcut ALT + F11 or click Visual Basic from the Developer Ribbon. Using the VBA Editor you can edit recorded Macros or write a Word Macro from scratch. When you click Edit, you open the VBA Editor.

You can see a list of all available Macros from View > Macros.Īfter recording a Macro, you will be able to from the Macro List: When you, Word will write VBA code into a Macro, allowing you to repeat your actions. Macros are blocks of VBA code that perform specific tasks. Is the programming language used to automate Microsoft Office programs including Word,, Outlook,, and Access. Note: If you’re brand new to Macros / VBA you might also find this article useful. This tutorial will teach you how to write a simple Macro and interact with Documents, Ranges, Selections, and Paragraphs. This is a tutorial for using VBA with Microsoft Word. While some of the examples / exercises are specific to Excel VBA, much of the content is generic to all VBA and you may find it useful to learn concepts like, ,, and more.īelow you will find simple VBA code examples for working with Microsoft Word. You might also be interested in our for Excel.
