XL 2007 GetEnabledMso("Undo") is always True
You've prompted me to dig deeper.
And you me. There certainly does seem to be a difference between the Undo
button on the QAT and the thing ExecuteMso("Undo")executes. That latter
thing morphs in the Redo control after a single use. Meaning it does what
ExecuteMso("Redo") would do if it existed.
I say "if it existed" because ExecuteMso("Redo") seems to always be invalid.
--
Jim
"Doug Glancy" wrote in message
...
| Jim,
|
| Thanks for your reply. You've prompted me to dig deeper. It works as you
| described, just not as stated in Help, which says "Returns True if the
| control identified by the idMso parameter is enabled." That is not what
| it's doing.
|
| For example, open a workbook and type "Jim". The Ribbon Undo button is
| enabled and the function returns True. Press the Ribbon's Undo button.
The
| button is now disabled and the function still returns True. At that point
| pressing Ctrl-Z doesn't undo the undo, but CommandBars.ExecuteMso("Undo")
| does, so it seems that these functions address the ability to undo the
| previous action as you described.
|
| Interestingly, CommandBars.FindControl(ID:=128).Enabled accurately
| represents the state of the button, i.e., when the Ribbon Undo button is
| disabled, it returns False. So I'm using that.
|
| For added interest try this. New workbook, enter "Jim" in two cells, in
the
| immediate window do CommandBars.ExecuteMso("Undo") a couple of times, and
| then try to use the Ribbon Undo button. It seems that this command only
| undoes the undo even though Help says "Executes the control identified by
| the idMso parameter."
|
| Thanks,
|
| Doug
|
| "Jim Rech" wrote in message
| ...
| However CommandBars.GetEnabledMso("Undo") always returns True.
|
| That's not exactly true. When you start Excel 2007 it is False and
after
| a Save it is also False. Ditto after running a macro that changes a
cell.
| In other words it seems to be fine. I'd guess you're mislead by it
| returning True most of the time. That's because it is available most of
| the time. For instance if you do an undo, undo is still available (to
undo
| the undo).
|
|
| --
| Jim
| "Doug Glancy" wrote in message
| ...
| In XL 2007, I'm using CommandBars.GetEnabledMso("Redo") to determine if
| the Ribbon control "Redo" is enabled and it returns True or False
| accurately. However CommandBars.GetEnabledMso("Undo") always returns
| True. I've googled this but don't see any mention. Does anybody know
how
| to make it work.
|
| Thanks,
|
| Doug
|
|
|
|
|
|