Microsoft Word Automation using VBA (Visual Basic for Applications)

Microsoft Word Automation using VBA (Visual Basic for Applications)


In Word, you can automate frequently used tasks by creating and running macros or VBA script . A macro is a series of commands and instructions that you group together as a single command under a procedure or function to accomplish a task automatically. This can be enhanced to take code development to the next level by understanding Word object reference. In this article we will see major objects which can be referred in VBA environment to automate various Word tasks.


  1. Application: refers to Microsoft Word Application
  2. Document: refers to a word file which opens withing Word Application
  3. Page: area where user performs editing
  4. Paragraph: refers to text block within page
  5. Section: specific page layout and formatting options (such as line numbering, columns, or headers and footers) for different parts of a document. Word treats a document as a single section until you insert a section break.
  6. Header/Footer: populate common information like Date, Page Number, Brand name etc at the bottom and top of the page which repeats on each page
  7. Selection: refers to current selection in a document
  8. Range: specific selected text range
  9. Bookmarks: to identify specific area by unique name within document similar to Name ranges in Excel
  10. Page breaks: refers to various type of page breaks within a document
  11. Tables: a physical table to populate data in row/column manner.
  12. Comment: a sort flag which can be attached to specific word, paragraph
  13. Track changes: to track changes in a document done by various users
  14. Borders: refers to various borders like page border, object border, table border etc.
  15. Building Block: A building block is pre-built content, similar to autotext, that may contain text, images, and formatting
  16. Canvas: to draw a object on the page can be floating or inline
  17. Chart: similar to Excel, Word also provide chart insertion within document
  18. Dialog: refers to various inbuilt dialogs like open, saveAs, format etc.
  19. Styles: another rich object to determine style of a paragraph, text, line etc.
  20. Hyperlink: we can insert various hyperlinks in Word document
  21. Shape: similar to Excel in Word also we can play with shapes
  22. TaskPane: refers to a side window which is used to perform object specific tasks
  23. Find & Replace: very useful object when dealing with a large document

Above list is enough to automate a Word environment however, there are many more options which user can explore during automating the job, some of them can be trapped using macro recording feature.

In my next article I will start explaining each object in details following three different languages i.e. VBA, VB.NET and C#

Please leave your comments or queries under comment section also please do subscribe to out blogs to keep your self upto date.

Leave a Reply

Your email address will not be published. Required fields are marked *