![]() |
#1
|
|||
|
|||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to dectect if close document and now no document open | skarden | Word VBA | 2 | 10-24-2022 07:03 AM |
![]() |
Joe528 | Word | 3 | 10-08-2021 06:12 PM |
Document close if/then/else error | eduzs | Word VBA | 1 | 01-02-2021 05:56 AM |
Save and Close powerpoint if it is inactive | MetteGaga | PowerPoint | 0 | 04-16-2015 05:14 AM |
Prompt when close the document | ubns | Word | 15 | 04-29-2012 10:07 PM |