Close inactive document
Hi,
i want to close a document automatically. It works for an active doc which is in the foreground. When I open another doc and place the doc i want to get closed in the background, the doc will not close.
To close the doc i have:
Application.OnTime When:=Now + TimeValue("00:00:30"), Name:="CloseDoc"
In function CloseDoc() is have:
Sub CloseDoc()
'Documents("file.docm").Activate
'ThisDocument.Close SaveChanges:=wdSaveChanges
Dim wdApp As Word.Application
Set wdApp = GetObject(, "Word.Application")
wdApp.Documents("file.docm").Close SaveChanges:=wdSaveChanges
End Sub
I've also tried the uncommented statements in the Sub, but none of them did it.
Any hint to solve the prob?
Thank you in advance & greetings
fops
|