Controlling a Word document that is already open from Access VBA

Posted on 2009-02-12
Last Modified: 2012-05-06
I want to do things to a Word document that is already open. However, I can't seem to be able to get an object to that document in Access VBA. How do I do it?
Question by:crescendo
    LVL 13

    Expert Comment

    Dim app As Word.Application

    Sub test1()

    Set app = GetObject(, "Word.Application")
    MsgBox app.ActiveDocument.FullName
    End Sub
    LVL 13

    Accepted Solution

    or by name

    LVL 9

    Author Closing Comment

    Thanks, I did ask for code to return an object, but that was easy enough. The issue was that I had more than one document open, so needed to specify the one I wanted. I was trying to use a full path, but only the name (as you showed) is needed.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    I'm writing to share my clumsy experience in using this elegant tool so you can avoid every stupid mistake I made. (I leave it to the authorities to decide if this deserves a place in the Knowledge archives.)  Now that I am on the other side of my l…
    A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
    With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now