Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Undo functionality w/ VBA?

Hi all -

I was wondering if anyone knew of a way to save the state of an excel
workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA
procedure or macro? For example, if my macro simply bold-faced a
particular cell, Ctrl-Z would revert the formatting to whatever it was
before? Any thoughts would be appreciated. TIA,

Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Undo functionality w/ VBA?

Kevin,

Running a VBA procedure clears Excel's undo buffer, effectively
disabling the Undo feature. The closest you can get is to create
a procedure that undoes your primary procedure, and use
Application.OnUndo to put that procedure in the undo buffer.
E.g.,

Sub AAAA()
Application.OnUndo "Undo This", "UndoProc"
End Sub

Sub UndoProc()
MsgBox "Undo code here"
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Kevin T. Ryan" wrote in message
om...
Hi all -

I was wondering if anyone knew of a way to save the state of an

excel
workbook so that users could Ctrl-Z (i.e. undo) changes made by

a VBA
procedure or macro? For example, if my macro simply bold-faced

a
particular cell, Ctrl-Z would revert the formatting to whatever

it was
before? Any thoughts would be appreciated. TIA,

Kevin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Undo functionality w/ VBA?

Kevin,

As Chip explained there isn't any built-in method. If you really need this
type of functionality, then one general approach might be to save a current
copy of the workbook before starting the VBA changes. If you need to revert
back, then close the current workbook and open the previously saved file.

Troy

"Kevin T. Ryan" wrote in message
om...
Hi all -

I was wondering if anyone knew of a way to save the state of an excel
workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA
procedure or macro? For example, if my macro simply bold-faced a
particular cell, Ctrl-Z would revert the formatting to whatever it was
before? Any thoughts would be appreciated. TIA,

Kevin



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Undo functionality w/ VBA?

Thanks guys, I'll probably try the "save-changes", re-open procedure
as it sounds a little easier to implement. Take care,

Kevin

"TroyW" wrote in message ...
Kevin,

As Chip explained there isn't any built-in method. If you really need this
type of functionality, then one general approach might be to save a current
copy of the workbook before starting the VBA changes. If you need to revert
back, then close the current workbook and open the previously saved file.

Troy

"Kevin T. Ryan" wrote in message
om...
Hi all -

I was wondering if anyone knew of a way to save the state of an excel
workbook so that users could Ctrl-Z (i.e. undo) changes made by a VBA
procedure or macro? For example, if my macro simply bold-faced a
particular cell, Ctrl-Z would revert the formatting to whatever it was
before? Any thoughts would be appreciated. TIA,

Kevin

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Go to functionality [email protected] Excel Worksheet Functions 0 November 7th 06 10:08 PM
With autorecover on in Excel you lose your "undo" functionality. AndyBofNY Excel Discussion (Misc queries) 0 April 28th 06 10:47 AM
Running of Worksheet Change Macro breaks undo functionality. Rob Manger Excel Discussion (Misc queries) 1 April 6th 06 04:04 AM
UNDO - how many times can I UNDO? Jane Excel Worksheet Functions 2 May 19th 05 03:03 AM
Why is my undo function in Excel only can undo the last 1 or 2 ch. 1111111111111111111111111111111111111111 Excel Worksheet Functions 1 November 24th 04 11:13 AM


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"