Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Call command using MS Word

Status
Not open for further replies.
Aug 21, 2001
8
US
Is there any way to open Microsoft Word one time within Access and then open multiple files in that one instance of Word? Right now we use Call Shell("Microsoft Word", File1) and then Call Shell("Microsoft Word", File2). This opens Word up 2 times, one for each file we want to open. We would like Word to open on the first instance of a call to Word, and then use the existing Application to open File2 ?
 
Yes. Just finished a project doing just that.
1) Establish connection to the Word object:
Dim wrdApp As Object
Set wrdApp = CreateObject("Word.Application")
2) In some sort of loop, open the selected Word Documents
Dim myDoc As Object
Set myDoc = wrdApp.Documents.Open(YourFileNamesHere)
do what ever you have to do
wrdApp.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
Set myDoc = Nothing
3) Finish with the WOrd object
wrdApp.Quit
Set wrdApp = Nothing

Be sure to change the SaveChanges parameter if you mean to save or discard changes. My app required the changes to be discarded.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top