Hi,

Is there a way to "group" VBA actions, so that when the
user performs undo (e.g. by pressing CTRL-Z), all the VBA
actions I have grouped are undone at once?

I would like something like the following:
----
Suppose there is some VBA command to start an undo group
(e.g. application.undo.start), then write some VBA
commands, and then close the undo group (e.g.
application.undo.end)
With my imaginary method, code could look like this:

application.undo.start
.range.delete
.range.insertafter "test"
application.undo.end

If the user now performs undo, both the delete action and
the insertion of text action would be undone at once. In
the real world, the user now has to press undo twice.
------

Of course, it doesn't work with my imaginary method, but
maybe somebody knows a way to do what i want...?

thanks
WArd

Re: group undo actions by Jay

Jay
Fri Dec 05 16:59:12 CST 2003

Hi, Ward,

Yes, you can do that. Look here for the code:

http://groups.google.com/groups?selm=387f8417.9282415%40news.xs4all.nl

"ward" <anonymous@discussions.microsoft.com> wrote:

>Hi,
>
>Is there a way to "group" VBA actions, so that when the
>user performs undo (e.g. by pressing CTRL-Z), all the VBA
>actions I have grouped are undone at once?
>
>I would like something like the following:
>----
>Suppose there is some VBA command to start an undo group
>(e.g. application.undo.start), then write some VBA
>commands, and then close the undo group (e.g.
>application.undo.end)
>With my imaginary method, code could look like this:
>
> application.undo.start
> .range.delete
> .range.insertafter "test"
> application.undo.end
>
>If the user now performs undo, both the delete action and
>the insertion of text action would be undone at once. In
>the real world, the user now has to press undo twice.
>------
>
>Of course, it doesn't work with my imaginary method, but
>maybe somebody knows a way to do what i want...?
>
>thanks
>WArd


--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://www.mvps.org/word

Re: group undo actions by ward

ward
Mon Dec 08 08:24:56 CST 2003

thanks
ward
>-----Original Message-----
>Hi, Ward,
>
>Yes, you can do that. Look here for the code:
>
>http://groups.google.com/groups?selm=387f8417.9282415%
40news.xs4all.nl
>
>"ward" <anonymous@discussions.microsoft.com> wrote: