Microsoft Word VBA Macro Programming - Introduction

Everything you need to know to confidentally start writing your own macros to automate Microsoft Word processes.
4.4 (66 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
5,523 students enrolled
Take This Course
  • Lectures 73
  • Length 13 hours
  • Skill Level Beginner Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 7/2014 English

Course Description

The video tutorials in this course are designed to give you all the ammunition you'll need to start creating your own custom macros to automate Microsoft Word tasks and operations. Word users learn VBA macro programming for a number of reasons: some people are looking to enhance their career prospects; some are looking to save themselves time; others are aiming to save their company money and increase productivity.

Whatever your reasons for considering learning more about Word VBA macros, this course aims to equip you with everything you need to get started.

This course was last updated on November 2015 with the addition of a module aimed at providing further practice by guiding the user, step-by-step, through the creation of an interactive Word VBA solution.

What are the requirements?

  • The course is aimed at users of Microsoft Word 2013, 2010 or 2007, running on Windows XP, Windows 7 or Windows 8.

What am I going to get from this course?

  • By the end of the training, you will have the knowledge required to start confidently writing VBA macros which automate procedures in Word and which will enhance your own profile as a Word user and a Word developer.

Who is the target audience?

  • This course is aimed at users with an intermediate or advanced knowledge of Microsoft Word but with little or no knowledge of VBA programming.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Getting Started

What you can expect from this course.


This lesson outlines the skills that you need to have in place before you can comfortably write your own macros from scratch.


In this tutorial we will download the course files, then install a gobal template inside which we will be saving all of the macros which we will create during the course.


The developer tab contains all of the options you'll need to start working with Word VBA...

In this video, we'll look at recording a macro and then editing the code generated by the recorder.

In this video, we'll look at adding a button to the Quick Access Toolbar which launches a macro when clicked.


In this video, we'll look at how you assign a keyboard shortcut to a macro.


In this video, we'll look at editing code generated by the macro recorder when you record a macro.


The macro recorder is a great way to check syntax that you are unsure of: you simply use the recorder, then look at the code that's been generated.

Section 2: Writing Macros in the Visual Basic Editor

Microsoft Word contains an application called the Visual Basic Editor (VBE) which is used for editing VBA code... Within the VBE, the first window that you need to get used to is the Project Explorer.


In this video, we'll have a look at some of the other windows in the Visual Basic Editor.


A macro is essentially a subroutine; so we'll be discussing the various types of subroutines that you can create inside a module.


In this video, we'll discuss some of the strategies you can use to find help on Word VBA topics.

Getting Help on VBA and the Word Object Model (Part 2)

In this two-part video, we'll look at how you can modify the way in which the Visual Basic Editor works by customizing the settings in the Tools > Options dialogue box.


In this two-part video, we'll look at how you can modify the way in which the Visual Basic Editor works by customizing the settings in the Tools > Options dialogue box.


The Project Properties settings allow to customize the way in which projects are displayed within the object browser.

Section 3: Variables and Constants

Variables are a facility found in all programming languages. They allow you to store information required by your programs and to refer back to that information, and modify it, at any time...


Although variable declaration is not compulsory in VBA, it is definitely recommended that you declare all variables that you intend to use...


Although variable declaration is not compulsory in VBA, it is definitely recommended that you declare all variables that you intend to use...


In this video, we'll look at declaring fixed length as well as variable length Strings; and we'll also look at a couple of VBA String functions.


In this video, we'll look at a couple of useful number functions; and we'll also look at how VBA handles the distinction between raw numbers and formatted numbers.


In this video, we'll look at how VBA enables you to work with Date variables. (We'll also have a quick look at Boolean variables.)


You'll very often need to keep track of values which will always be the same as your code executes; these are the kinds of values which you store in constants, rather then in variables.


In this video, we'll talk about using variables to store references to the Document, Range, Table and Row objects.

Section 4: Subroutines and Functions

In this video, we'll discuss a technique which allows you to have one main sub-procedures which calls a series of subordinate sub-routines.


In this video, we'll look at functions and how they differ from sub-routines. (The main difference is that functions can return a value.)


In this video, we'll look at how you can make your functions more flexible by defining arguments, or parameters.


VBA allows you to make arguments optional; which means that, when you call the function or sub-routine, you can either supply a value, or you can simply omit it.


When you divide your code into various sub-procedures, the question of variable scope becomes important...

Section 5: Conditionals, Loops and Arrays

We begin this section on conditional and looping statements with a look at the VBA If statement.


The Select ... Case statement provides and alternative to If and ElseIf when testing for several possibilities.


The For ... Next loop allows you to execute several lines of code repeatedly, a given number of times.

For...Next Statements (Part 2)

As well as using a counter to control looping, it is also possible to use a condition...

While…Wend Statements

Array variables allow you to store a related set of values, rather than a single value, like the variables we have seen so far...

Using Array Variables (Part 2)

Dynamic arrays are used in situations where you are not sure how many elements you need to cater for or where the number of elements can vary as your code executes.

Section 6: The Word Object Model

This video gives an overview of how the Word object model functions, its key aspects and key components.


In this video, we look a bit more closely at the syntax involved when working with object methods.


Properties are essentially the attributes of an object. However, to access these properties, you sometimes have to go via a child object...


In this video, we'll look at the syntax for homing in on individual objects.


In this video, we will look at why it is a bad idea to write code which selects and activates objects, rather than simply referencing them.


Before creating a reference to an object, you need to be sure that it actually exists. In this video, we look at how you test for the existence of an object within a collection.


In order to remove items from a collection, the logical thing to do is to loop through the collection and selectively delete certain items...

Section 7: Events, Dialogs and UserForms

In this first video, we will get an overview of how event programming works.


In this two-part video, we will see a practical example of how document events can be implemented within a Microsoft Word workflow.

Working with Document Events (Part 2)

Very often, you can simply avail yourself of Word's built-in dialogs, rather than having to reinvent the wheel and create your own user form.


In this video, we will take a closer look at creating a user form and adding various types of control to the user form.

Creating a UserForm (Part 2)

In this two-part video, we'll create a series of event procedures, to convert the form that we created in the last video, into an interactive form.

Creating UserForm Event-Handlers (Part 2)

When working with user forms you have to bear in mind that the user will not always enter data in the format, range or attributes that you want them to.

Section 8: Error Handling and Debugging

Before you share your macro solutions with colleagues or clients, it's always a good idea to think about shielding them from any unpleasant surprises...


In this video, we will revisit Tools > Options and discuss the settings relating to error handling.


In this video, we'll look at a statement which tells VBA to simply ignore any errors that occur and attempt to carry on as though nothing has happened...


The Err object is a resource that is built into VBA which provides information on errors, as they occur...


In this video, we'll turn our attention to debugging; tracking down errors when you can't get your code to work properly...


In this video, we'll talk about stepping through your code, in break mode.


The watch window provides a very convenient and dynamic method of exploring the values of expressions and variables while debugging code...

Section 9: Additional Step-by-Step Practice
Obtaining the course files
Overview of Project
Creating the Launch Macro
Creating the UserForm
Listing File Names in the Listbox Control
Updating the Preview Text Box
Programming the Remove Button
Programming the Move Up and Move Down Buttons
Programming the Cancel Button
Programming the Main Action Button Part 1
Programming the Main Action Button Part 2

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Grant Gamble, Developer, trainer and author

Grant Gamble is an experienced IT trainer, developer, consultant and author able to deliver a wide range of training courses. He has a vast experience of delivering public and on-site IT training content at different skill levels, to groups of varying sizes.

His UK company G Com Solutions Limited provide IT training courses and consultancy to a wide range of UK and international clients. His speciality is running week-long, intensive training workshops on topics like Microsoft VBA, web development and Adobe Creative Suite automation.

Ready to start learning?
Take This Course