I am trying to get a document to close when saved using VBA.
I have searched for this extensively but mostly it comes up with people trying to not tu off saving when closing a document. GRRRRRRR! What I have so far is the following (I removed the unrelated code).
Private Sub App_DocumentBeforeSave(ByVal Doc As Document, SaveAsUI As Boolean, Cancel As Boolean)
ActiveDocument.Close
End Sub
This causes word to crash and the document not to save, possibly because it is in the wrong procedure? Replacing ActiveDocument.close with App.Quit works but this closes all open documents(this is not the desired behaviour).
Any ideas will be greatly appreciated.
برچسب:
نویسنده: استخدام کار