test that there is something to undo before executing application.
On Error Resume Next
ud = Application.CommandBars.FindControl(ID:=128).ListC ount
' could test for err.number, if 0 but ud=0
' probably means Redo has at least 1 item that'll
' get called with app.undo
On Error GoTo 0
Even though Commandbars are replaced with the Ribbon in 2007 this still
appears to work in 2007
If the intention is to call .Undo but you're only concerned about an error
if Undo is empty, just do simply
On error resume next
Application.Undo
On error goto 0
Regards,
Peter T
"pwrob" wrote in message
...
hi, is there a way to test that there is something to undo before
executing
an Application.Undo?
Thanks,
pwrob
--
xl help seeker
|