Microsoft Word VBA (2 days – £1,190, plus VAT)

Our Word VBA Introduction is designed for users who know Microsoft Word very well but who have no knowledge of VBA programming. It familiarises users with essential Visual Basic syntax and programming techniques and introduces them to the Microsoft Word object model. By the end of the training, delegates will know how to write VBA macros from scratch; as opposed to relying on the Macro Recorder.

Getting Started

Welcome to Microsoft Word VBA Macro Programming, What is involved in learning Word VBA?, Getting Set Up, The Developer Tab and Macro Security, Recording a Macro, Attaching Macros to the Quick Access Toolbar, Assigning a keyboard shortcut to a macro, Editing a Recorded Macro, The Benefits and Limitations of the Macro Recorder

Writing Macros in the Visual Basic Editor

Understanding the Project Explorer, Other VBE Windows and Toolbars, Macros and Subroutines, Getting Help on VBA and the Word Object Model, Setting VBE Options, Setting Project Options

Variables and Constants

Declaring and Populating Variables, Variable Data Types, String Variables, Number Variables, Date Variables, Declaring Constants, Using Object Variables, Variables Versus With Statements

Subroutines and Functions

Defining and Calling Subroutines, Defining and Calling Functions, Passing Arguments, Using Optional Arguments, Variable Scope, Using VBA Functions

Conditionals, Loops and Arrays

If Statements, Select Case Statements, For…Next Statements, Do…Loop Statements, While…Wend Statements, Using Array Variables, Working with Dynamic Arrays

The Word Object Model

Understanding the Word Object Model, Working with Object Methods, Working with Object Properties, Referring to objects within a collection, Referencing Versus Selection and Activation, Testing for the Existence of an Object, Removing Objects from a Collection

Events, Dialogs and UserForms

Overview of Event Programming, Working with Document Events, Using Built-in Dialogs, Creating a UserForm, Creating UserForm Event-Handlers, Validating User Input

Debugging and Error Handling

Syntax, Compilation, Run-time and Logic Errors, Overview of Debugging Techniques, Stepping through Code, Using Watches to Monitor Code Elements, Using the Immediate, Locals and Call Stack Windows, Common Types of Error, Using On Error GoTo and Resume Statements, Using the Err and Error Functions