?
Solved

Controlling a Word document that is already open from Access VBA

Posted on 2009-02-12
3
Medium Priority
?
534 Views
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?
0
Comment
Question by:crescendo
  • 2
3 Comments
 
LVL 13

Expert Comment

by:Surone1
ID: 23624818
Dim app As Word.Application



Sub test1()

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

Accepted Solution

by:
Surone1 earned 1500 total points
ID: 23624869
or by name

app.Documents("doc1.doc").PrintPreview
0
 
LVL 9

Author Closing Comment

by:crescendo
ID: 31546162
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.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Suggested Courses

840 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