troubleshooting Question

Opening a Form contained in a Word document via VBA automation from Access

Avatar of Declan Basile
Declan BasileFlag for United States of America asked on
Microsoft AccessVBAMicrosoft Word
12 Comments1 Solution97 ViewsLast Modified:
From vba in Microsoft Access, how can I open a form saved in a word .docm document and set a textbox on the form to a value?

So far I have:

    Dim objwrd As New Word.Application
    Dim doc As Word.Document
    Set objwrd = CreateObject("Word.Application")
    objwrd.Visible = True
    Set doc = objwrd.Documents.Open(FileName:="C:\Users\db1\Documents\Test.docm", Visible:=True)

I know if I'm running code contained in the Word document I can do something like this

Dim frm As New UserForm1

But this code is automation code running in Microsoft Access and I don't see a forms collection in the Document object.
Declan Basile

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 12 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros