Turn off Undo during macro

P

Peter Aitken

I have a long VBA macro that makes a lot of changes to the document. While
it is running I get messages that Word does not have enough memory and that
Undo will not be available for the actions. I'd like to prevent these
messages. Is it possible?
 
J

Jay Freedman

I have a long VBA macro that makes a lot of changes to the document. While
it is running I get messages that Word does not have enough memory and that
Undo will not be available for the actions. I'd like to prevent these
messages. Is it possible?

Hi Peter,

I assume you're working in a loop of some sort. Include an
ActiveDocument.UndoClear statement in the loop. That will prevent the
undo buffer from filling up, which is what causes the messages.
 
H

Howard Kaikow

i've never understood why msft gives us a means to clear the undo stack, yet
does not give use a means to shut down the undo stack.

activedocument.undoclear is a relatively slow statement, noticeable
performance it, better if we could just shut down the stack.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top