#1
|
|||
|
|||
how to properly cancel the current process through AutoClose() sub()
Hello,
when closing a document (which already exists in the base and which I open by clicking on it), vba passes through the AutoClose() procedure which has no arguments, and not in BeforeClose(Cancel As Boolean) as it does for a newly created document. The problem I have in this case is that I can't properly cancel the current process, as can be done in BeforeClose(...) with Cancel = True. Is there a solution to simulate a BeforeClore in an AutoClose without input arguments? Best Regards, David |
#2
|
|||
|
|||
For those who are interested, here is a solution to avoid this problem
You just have to put at the beginning of the AutoClose() procedure (procedure without input argument) the following line of code: ActiveDocument.Saved = True From there, for word the document is saved. This "replaces" a bit a Cancel=True that we find for example in the procedure BeforeClose(...) of a class or other. However, you must now manage the closing, saving... of the document yourself, otherwise word closes it without asking anything. Well, it's not perfect yet, but it gives us something that may help a bit |
#3
|
|||
|
|||
Sorry but the idea proposed before doesn't do all the work because word still takes over at the end, i.e. the process of closing word can't be stopped as it can be done with Cancel = true in BeforeClose(...)
So I still don't have a solution for this :-( |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to cancel a selection? | johngross | Word VBA | 1 | 01-12-2019 10:15 PM |
How to call current PC date and/or current PC year | KIM SOLIS | Excel | 2 | 11-04-2011 06:09 PM |
How to cancel printing?? | RDA1959 | Word | 1 | 08-28-2011 12:44 AM |
Auto insert current month's name and current year | Styler001 | Word | 4 | 01-25-2010 06:40 PM |
Problem with AutoClose macro and Word 2003 | cholo | Word VBA | 0 | 07-08-2009 05:48 AM |