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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List all open Word docs and close specific docs

Status
Not open for further replies.

AlexBeet

IS-IT--Management
Aug 2, 2001
12
GB
I need to be able to find out the names of all open Word documents and close specific documents if they are open.
Some of the documents may be hidden.
The script would ideally work with both Word 97 and Word 2000 and be called from an Access 2000 database.
Is there an easy way to do this ?

Thanking you in advance.
 
I believe you would have much better probability of a solution if you used the Word COM object rather than coded a solution in Access. Use the application object to determine the number of open documents.

Public Sub CloseAllWordDocs()

Dim adoc As Document
For Each adoc In Documents
aName = aName & adoc.Name & vbCr
adoc.Close
Next adoc
MsgBox aName

End Sub

Steve King Growth follows a healthy professional curiosity
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top