We help IT Professionals succeed at work.

Open Microsoft Word Document in Access

How would I go about setting up a a button in Access 2013 to open a certain word document and insert in information from access? Example is we have a label printer so I was going to set it up to get mailing information and print to that printer which I have done but sometimes we need to edit the mailing address so I would like to open a blank word document and edit from there unless there is a better solution. Thanks
Watch Question

Software & Systems Engineer
Distinguished Expert 2019
Try this for a start

Dim objWord As Object
Dim objDoc As Object
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add(ThePathToTheDocumentYourAreGoingToUseAsTemplate)
With objDoc
.formfields(NameOfTheFormField).result = TheValueYouWantToPass

End With
    Set objDoc = Nothing
    Set objWord = Nothing

Open in new window

In order for this to work you need to use Form Fields
Fabrice LambertConsulting
Distinguished Expert 2017

easy enough:
public sub button1_onClick()
On Error Goto Error
    Dim app As Object    '// Word.Application
    Dim doc As Object    '// Word.Document

    Set app = createObject("Word.Document")
    set doc = app.Documents.Add    '// create an empty document
    app.Visible = True

    '// manipulate your document here

    doc.SaveAs2 "c:\.............."
    set doc = Nothing
    app.Quit False
    set app = Nothing
Exit Sub
    If Not(doc Is Nothing) Then
        doc.Close False
        Set doc = Nothing
    End If
    If Not(app Is Nothing) Then
        app.Quit False
        Set app = Nothing
    End If
End Sub

Open in new window

Do not close the document neither exit the application if you want to keep it open, just set the objects to Nothing.