MS Word - Visual BASIC for Applications (VBA)

 

Duration: TWO DAYS Training Course for Non-Programmers

 

Overview and Goals:

This course has been specially designed for the advanced Word user who wishes to make use of the more powerful facilities of MS Word made available by VBA. This course explores VBA language and delegates will develop a small project to ensure that future editing, amending, updating and data extractions can be carried out with the minimum of effort. The course is aimed at those with little or no previous programming background, although experienced programmers wishing to learn VBA will find it a quick and valuable introduction to the language. Previous experience of recording Word macros is desirable though not essential. Throughout the course the theme of adopting good programming practices will be encouraged.

 

Course Objectives:

To introduce the techniques of programming in VBA through the automation of typical Word tasks.

 

Who should attend:

Word users who have a strong working knowledge of the product. A good understanding of the architecture of Word, including templates, styles and fields, is assumed.

Course Content:

 

Introduction: 

The role of VBA in MS Word

Solving problems with VBA

  

Bookmarks: 

What are Bookmarks?
Defining & Using Bookmarks
Predefined Bookmarks

 

Document Templates:

Creating & Using Templates 

  

Introduction to Macros: 

Macros What, Why, When and How?
Recording & Running a Macro
Auto Macros
Macros and templates
Selecting a Bookmark in a Macro

 

Editing Macros: 

Visual Basic Editor; Procedures
Inserting Comments
Printing a Visual Basic Module

Naming Conventions: 

Advantages of using clear Naming Conventions
Memory Variables
User Form Controls

User-Defined Forms
Adding Form Controls
Form Control Properties
Control and Dialog Box Events
Displaying and Dismissing a User Form
Handling Form Controls

Creating VBA Projects: 

Structuring an application
Identifying Modules and procedures
Writing and testing tight and concise VBA code
Adopting good programming practices
The Range Object
Working with Range Objects; Story
Navigating in Word
Inserting, Deleting and Editing Text

Basic Text Formatting Objects, Properties and Methods: 

What are Objects and Collections?
What is a Property? What is a Method?
Returning an Object

Variable and Constants: 

Variable; Data Types; Constants

Control Structures: 

Conditional Control Structures
Looping Control Structures
FOR...NEXT
Performing Multiple Actions on an Object
Non-Structured Statements
Sub Procedures

Controls, Dialog Boxes and Forms: 

Built-in Dialog Boxes
Predefined Dialog Boxes

 

Debugging & Error Trapping:

Errors; Break Mode
Quick Watch; Stepping
Error Handling

 

Course Summary

 

What you will be able to do:

Create and automate template selection
Record, edit and write VBA procedures to automate repetitive or complex tasks
Use the Visual Basic Editor to organise, debug and run procedures
Use control structures and decision-making devices
Create user-interactive procedures, including user-forms and custom dialog boxes
Utilise bookmarks for text insertion
Automatic creation of pre-defined tables
Edit headers and footers
Automatic displaying/hiding of toolbars