How to Access VBA to Open a Word Document

Written by jaime avelar
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Access VBA to Open a Word Document
How to open a Word document using Visual Basic for Applications (VBA). (orange abstract background texture image by Suto Norbert from

Knowing how to open a Microsoft Office Word document and add data to it using Microsoft Visual Basic for Applications (VBA) can be useful when you need to export data from Access. Word is a word processing application included in the Microsoft Office suite. Access is a database management system that is mainly used for smaller databases. VBA is a programming language developed by Microsoft used to automate manual processes. It just takes a few steps to learn how you can create a new Word document and open it using VBA.

Skill level:


  1. 1

    Start Microsoft Office Access 2007. Click "Blank Database" and "Create." Select "Database Tools" then click "Visual Basic." Click the "Insert" menu and select "Module."

  2. 2

    Click the "Tools" menu then select "References." Check the box next to "Microsoft Word 12.0 Object Library" and select "OK."

  3. 3

    Type the following to create a new subroutine:

    Private Sub openWordDocument()

    Press "Enter."

  4. 4

    Type the following to create two new Word variables:

    Dim wrdApp As Word.Application

    Dim wrdDc As Word.Document

  5. 5

    Type the following to define your variables and to add a new document:

    Set wrdApp = CreateObject("Word.Application")

    wrdApp.Visible = True

    Set wrdDc = wrdApp.Documents.Add

  6. 6

    Type the following to add new text to the Word document:

    With wrdApp

     .Selection.TypeText Text:="This text was added to a new Word document from Access."

    End With

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.