grouping actions for undo

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Roel Vanhout (roel_at_riks.nl)
Date: 03/12/04


Date: Fri, 12 Mar 2004 12:31:44 +0100

Hello all,

This is my first attempt at writing vba things, so please excuse me if
I'm asking obvious things here.
I'm trying to do the following: when a button in the toolbar is pressed,
a form should show up, with some field that can be filled in. When 'ok'
on that form is clicked, the fields should be entered into the word
document with some formatting applied. I have the form running and I can
insert text. Because I need to do formatting I'm inserting every part
with Selection.InsertAfter and then I apply the formatting to that part.
So far so good, but I'd like to make it so that when a user does this
and presses 'undo' that the whole thing I just inserted is removed
again. Because of the multiple edit actions that I do, the user has to
undo every action that I did programmatically, which is around 20 or so
(for now). How can I 'group' editing actions so that they all get undone
simultaniously? Thanks.

cheers,

roel


Quantcast