I have a set of Word macro's that format documents that are sent to from an external source. Usually there are a lot of changes made to the document, all of which are recorded in the undo history, which I don't want.
Is there a way to not add all of these changes to the undo history, but rather just add one undo action that will undo everything the macros have done? Thanks.
This is not available for Word 2007 or earlier. The UndoRecord object was added in Word 2010 and lets you "clump" actions made in VBA into a single UndoRecord, to which a custom "label" for the Undo list can be assigned. The Undo actions can be nested at various levels. More than one UndoRecord object can be created. More information is available in the MSDN documentation
https://msdn.microsoft.com/en-us/library/office/ff821168(v=office.14).aspx
来源:https://stackoverflow.com/questions/14832053/dont-add-changes-made-via-vba-to-the-undo-history