Closing

Application.ActiveDocument.Close SaveChange:=wdSaveOptions.wdPromptToSaveChanges 
                                 OriginalFormat:=wdOriginalFormat.wdPromptUser
                                 RouteDocument:=False

All these arguments are optional
The RouteDocument is optional and can be set to True to route the document to the next recipient
If the document does not have a routing slip attached then this argument is ignored.


Application.Documents("document.doc").Close 
Documents("document.doc").Close
Documents(1).Close
objDocument.Close


Close all Documents without saving

You can use the Documents collection to quickly close all the currently open documents.

Application.Documents.Close SaveChange:=wdSaveOptions.wdDoNotSaveChanges 


Exiting Word

Application.Quit SaveChanges:=wdSaveOptions.wdPromptToSaveChanges 
                 Format:=wdOriginalFormat.wdWordDocument
                 RouteDocument:=False


© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext