Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, 2013, 2016, 2019, and Word in Office 365. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Clearing the Undo Stack in a Macro.
by Allen Wyatt
(last updated November 13, 2020)
Normally, as you are making edits in your documents, Word keeps track of what you do. Word does this so you can later use the Undo and Redo commands on the toolbar. What if you are developing a macro, however, and you don't want the user to be able to undo changes? In this case, you can use the UndoClear method in your macro, as follows:
In this usage, UndoClear wipes out the Undo stack (the list of actions that is remembered by Word) for the active document. Note that this affects only those actions that have been recorded so far; any new actions will be duly recorded and available on the stack.
WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13275) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, and Word in Office 365. You can find a version of this tip for the older menu interface of Word here: Clearing the Undo Stack in a Macro.
The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!
Want a fast way to add brackets around a selected word? You can use this simple macro to add both brackets in a single step.Discover More
Do you need to step through a table, cell by cell, in a macro? It's easy to do using the Move method, as described in ...Discover More
Need to create a directory from within a macro? You can do it using a single command line, as detailed in this tip.Discover More
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.