Advanced Microsoft Word VBA Macro Programming
4.6 (5 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.
74 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Advanced Microsoft Word VBA Macro Programming to your Wishlist.

Add to Wishlist

Advanced Microsoft Word VBA Macro Programming

Excel VBA macro programming isn't all there is to VBA. Take a deep dive into Microsoft Word automation.
4.6 (5 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.
74 students enrolled
Created by Grant Gamble
Last updated 7/2017
Curiosity Sale
Current price: $10 Original price: $125 Discount: 92% off
30-Day Money-Back Guarantee
  • 13.5 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • You will gain a deeper understanding of the how to use VBA to control the key elements of both the Word and VBA object models.
  • You will become familiar with the programmatic representation of Word's key textual components: paragraphs, sentences, words, characters...
  • You will learn how to programmatically create and modify long and complex documents containing multiple sections with different headers and footers.
  • You will learn how to target and control other Office programs (such as Excel, Outlook and PowerPoint) from within your Word macros.
  • You will learn how to build form-based solutions which leverage Word's powerful content controls feature.
View Curriculum
  • This course assumes that the user is already familiar with the basics of Word VBA programming.

This advanced Word VBA macro programming course is designed for users who are already comfortable with the basics of Word VBA macros, and who have progressed beyond relying on the Macro Recorder.

If you are still new to Word VBA, have a look at the Udemy course "Microsoft Word VBA Macro Programming – Introduction".

This advanced Word VBA course carries on from where the above Introductory course finishes.

The main purpose of this course is to take a deep dive into programming the Word VBA object model; but in a practical, hands-on kind of way.

Here’s a summary of what you will learn:

  • You will learn how to program the Application object, which represents Word itself; how to check the user's location and screen resolution; and how to check which fonts are used in a particular document.
  • Moving onto files and documents, you will learn how to process all files in a given Folder; how to archive files older than a certain date; and how to test whether a given Document is currently open.
  • Next, when we turn our attention to the Range and Selection objects, you will learn the similarities and differences between these two objects; and when to use one in preference to the other. You'll learn the important Word programming skills of verifying the type of object which is currently selected and checking the page location of the selection.
  • In the chapter on Word text objects, you will learn the VBA syntax for processing paragraphs, sentences, words, characters and ranges. You will gain confidence in how to have your macros perform operations like inserting text and copying text without wiping the user's clipboard.
    This is also the section in which you will learn how to program the Range.Find object to find and replace both text and formatting attributes; how to change the Case of Text, how to create bulleted and numbered lists; how to use the Word VBA objects used which control the formatting of text; how to create style; and how to create tables of contents.
  • Once we’ve covered the nuts and bolts of working with text, we'll examine the code which you need when working with longer, more complex documents. In this section, you will learn how to create sections, headers and footers; how to work with odd and even headers and footers; how to use the LinkToPrevious Property; inserting Page Numbers; insert an image into a Header; and how to program the PageSetup Object.
  • Then we'll turn our attention to creating and manipulating tables with VBA code; performing such operations as merging cells, formatting tables, converting text to a table, we'll create a macro which will transpose the rows and columns of the currently selected table.
  • The course also covers content controls and interactive forms. You will learn how to combine this powerful feature with VBA programming; how to create content controls programmatically; and how to write code which responds to content control events.
  • Towards the end of the course, we'll discuss the different ways of distributing Your VBA macro solutions.
  • And, to end the course, we'll create a series of solutions which demonstrate how to write Word VBA code which controls not only the Word object model, but the object models of other Microsoft Office programs.
    We'll create three inter-application solutions: the first combining Word and Excel workflows; the second Word and Outlook; and the third, Word and PowerPoint.

So, by the end of this course, you will have a good grasp of all of the intermediate and advanced Word VBA programming techniques that you'll need to master, in order to feel comfortable when undertaking Word VBA projects; either in the workplace, or as a consultant.

Who is the target audience?
  • This course is designed for people wanting to expand their existing knowledge of Word VBA programming.
Students Who Viewed This Course Also Viewed
Curriculum For This Course
50 Lectures
Getting Started
2 Lectures 12:55

Downloading the Course Files
9. The Application Object
4 Lectures 49:27

In this video we examine how to use the Application.UserName property when interacting with the user.

Preview 13:31

In this lecture, you will learn how to use the properties of the Application.System object to verify the user's country, and screen resolution.

Preview 10:56

In this lecture, we learn how to use the Application.OnTime method to schedule the running of a macro at a specified time.

Preview 14:10

In this video, we look at using Application.FontNames and Range.Find objects in conjunction to find out which fonts are used in the active document.

Preview 10:50
10. The Document Object
5 Lectures 52:48

After watching this video, you will know how to use the VBA Dir function to process all of the files in a given folder.

10.1: Processing all Files in a Folder

In this video tutorial, we will look a the VBA code for examining all of the files in a folder and archiving all those whose modification date is older than a certain threshold.

10.2: Archiving Old Files

In this video, we take a step-by-step look at how Word's document collection behaves, as documents are added and removed using the New, Open and Close methods.

10.3: The Documents Collection

In this video, we look at how to loop through the documents collection and test to see whether a give file is currently open.

10.4: Testing Whether a Document is Open

In this tutorial we look at how the documents collection is modified by the Add, Open and Close methods of the Document object.

10.5: Creating, Opening and Closing Documents
11. The Range and Selection Objects
4 Lectures 43:04

In this tutorial, you will gain a deeper understanding of the similarities and differences between the Selection and Range objects, as well as the benefits of using the range object when writing VBA code.

11.1: The Range and Selection Objects compared

This video explains how to use the Selection.Type property to gauge whether the user has made the kind of selection required for a particular macro to run successfully.

11.2: Verifying the Selection Type

In this video, you will learn how to use the Selection.Story property to verify whether the user has made a selection in the main area of the page or within a header or footer.

11.3: Verifying the Selection Story

In this tutorial, we examine the very versatile Information property which is available on both the Range and Selection objects; and how it can be used to test whether the user's current selection is within a table. We then move on to using it to verify whether the Caps lock is currently active.

11.4: Verifying Selection or Range Information
12. Working with Text
10 Lectures 02:55:20

Here, we examine the Paragraph object and how the properties of it parent, the Paragraphs collection can often be used directly without the need of looping through individual paragraphs.

12.1: Working with Paragraphs

Now we drill down inside the Paragraph object and discuss the Sentences, Words and Characters collection objects and the Range objects which they all contain.

12.2: Working with Words and Characters

Copying text is a frequent requirement with Word VBA macros. In this video, you will learn how to copy text cleanly, and without interfering with the contents of the user's clipboard.

12.3: Copying Text

In this video, you will discover how to use the methods of the Range object to insert new text into a document.

12.4: Inserting Text

In this tutorial, you will learn how to use the methods and properties of the Range.Find object to find and replace text within a document.

12.5: Using the Find Object

Here, we look at the using the Range.Case property, the equivalent of Word's Change Case command. We then move onto creating an intelligent title case macro, which does not capitalize unimportant words, such as "the".

Preview 11:45

In this video, we look at the intricate code involved when working with lists. You will learn how to create and format both numbered and bulleted lists using VBA.

12.7: Working with Lists

In this video, we discuss the formatting of text using VBA. You will learn to distinguish between those formatting properties which are accessed using the Range.Font object, and those provided by Range.ParagraphFormat.

12. 8: Formatting text

In this tutorial, we look at how the Style property/object to control the formatting of Paragraph, Range and Selection objects. We also examine the properties of the style object itself; and discuss how VBA distinguishes between paragraph and character styles, as well as between Word's built-in styles and user-defined ones.

12.9: Working with styles

In this video, we'll look at the VBA code involved in creating and updating Microsoft Word tables of contents.

12.10: Creating a Table of Contents
13. Sections, Headers and Footers
7 Lectures 02:02:25

We begin this chapter by talking about the VBA code needed to create new sections; and how to specify key attributes of the new section, such as the number of columns.

13.1: Creating Sections

In this tutorial, we discuss the PageSetup object, which is a property of both the Document and Section objects.

13.2: The PageSetup Object

In this video, and in the remaining videos in this chapter, we examine the manipulation of headers and footers using VBA code.

13.3: Creating Headers and Footers

This tutorial explains how to use the LinkToPrevious property to programmatically determine whether you have different headers and footers in the different sections of the same document.

13.4: The LinkToPrevious Property

In this tutorial, we examine the VBA code required to allow headers and footers on the left and right pages of a document to have different attributes and content.

13.5: Odd and Even Headers and Footers

We've already encountered page numbers in a couple of the videos within this section. In this tutorial, we'll talk a bit more about page numbers; and how you can use VBA to customize them.

13.6: Inserting Page Numbers

We end this chapter on sections, headers and footers by looking at the VBA code for inserting an image into a header.

Preview 14:26
14. Working with Tables
6 Lectures 01:45:05

From a programming point of view, you may often need to create tables in your VBA workflows; whenever you want the output to be in a tabular format. In this tutorial, we will examine the VBA syntax for creating tables.

14.1: Creating Tables

In this tutorial, you will learn the two main VBA techniques for merging table cells; merging entire rows or columns; and merging from one individual cell to another.

14.2: Merging cells

In this video, we'll look at the VBA syntax for formatting tables; using both by the Table.Style property and by customizing the Borders and Shading properties.

14.3: Formatting Tables

In this tutorial, you will create a macro which scans a document for tabular data; and, whenever it encounters it, converts the data into a Word table.

14.4: Converting Text to a Table

Unlike Excel, Word VBA does not contain a function for transposing tabular data; so, in this tutorial, we remedy this by creating macro which will transpose the rows and columns of the currently selected table.

Preview 16:47

In this tutorial, we improve the VBA code generated by the macro recorder which allows the user to user to sort data by clicking on column headings.

14.6: Sorting Table Data
15. Content Controls and Interactive Forms
5 Lectures 01:34:36

When a content control is created, Word automatically displays default text which cannot be modified in the user interface. In this tutorial, we discuss the VBA code for programmatically modifying this placeholder text.

15.1: Customizing Placeholder Text

There are a number of scenarios in which you may need to create content controls programmatically. In this video, we'll look at one such scenario.

15.2: Creating Content Controls Programmatically

From the programming point of view, the main benefit of working with content controls is that you can write code which executes as the user interacts with the control. This is done by creating event procedures; and that's what we'll be looking at in this video.

15.3: Control Events

We learned how to create text controls earlier in this section. In this video, we move onto the creation of combo boxes and drop-down lists.

15.4: Drop-down Lists and Combo Boxes

In this final video on programming Word content control, we will discuss the picture control and write VBA code which updates the picture when the chooses an option from a drop-down menu.

15.5: Using the Picture Control
16. Distributing Your VBA Solutions
3 Lectures 13:02

In this video we look at the most basic way of distributing your VBA macros, which is to distribute the raw code; and then to provide instructions to the other party, as to how they should deploy the code.

16.1: Distributing raw VBA code

In this tutorial, we move onto look at a slightly more sophisticated way of distributing code, which is to distribute a complete VBA module.

16.2: Distributing a VBA module

In this video, we'll look at what is, perhaps, the most professional method of distributing and deploying your VBA code; which is to use a Word add-in or global template.

16.3: Distributing a Word Addin
17. Targeting Other Office Programs
4 Lectures 02:08:01

In the first video of this section provides an overview of the techniques involved in referencing another Office application from within a Word macro.

17.1: Referencing other Office Applications

In this tutorial, we will create a VBA solution which uses both Microsoft Word and Microsoft Excel to create the final output.

17.2: Controlling Excel from a Word Macro

In this video, we will discuss the VBA code for controlling Microsoft Outlook from within a Word macro and sending out a series of email messages.

17.3: Controlling Outlook from a Word Macro

In our final project, we will create macro which generates a PowerPoint presentation based on the contents of a Word document.

17.4: Controlling PowerPoint from a Word Macro
About the Instructor
Grant Gamble
4.5 Average rating
424 Reviews
13,104 Students
7 Courses
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 Power BI, VBA, web development and Adobe Creative Suite automation.