Undo disappeares when change is made through VBA


Posted by Gil on January 09, 2002 1:35 AM

How can i call the undo function?
I have written a program at VBA for excell, when the program is activated the "Undo" button is disabled, how can i enable it again, and will the button do it's job?
Thanks,
Gil.

Posted by DK on January 09, 2002 4:29 AM

Hi Gil,

Are you trying to use Undo to undo what was done by your VBA code? If so, then unfortunately that can't be done. It is possible to use API calls to you Undo changes made to ActiveX controls (e.g. textboxes, combo boxes) but you can't undo a macro because the required data isn't stored anywhere.

D.



Posted by Juan Pablo G. on January 09, 2002 5:47 AM

This isn't exactly true.
But, what you have to do is create a new sub that undoes your macro, and then, at the end of it, put a line like

Application.OnUndo "MyUndo"

Juan Pablo G.