ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   XL 2007 GetEnabledMso("Undo") is always True (https://www.excelbanter.com/excel-programming/419734-xl-2007-getenabledmso-undo-always-true.html)

Doug Glancy

XL 2007 GetEnabledMso("Undo") is always True
 
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



Cornflicks

XL 2007 GetEnabledMso("Undo") is always True
 
Hello Mr. Doug Glancy,
I don't know you but I want to pay someone to write a simple
accounting program using excel for my new business. I think it is easy for a
person familiar with excel programming. Please tell em if you can help. My
email

Jim Rech[_2_]

XL 2007 GetEnabledMso("Undo") is always True
 
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




Doug Glancy

XL 2007 GetEnabledMso("Undo") is always True
 
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






Jim Rech

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
|
|
|
|
|


Doug Glancy

XL 2007 GetEnabledMso("Undo") is always True
 
Jim,

The ExecuteMso("Redo") works for me. And then there is repeat, which seems
to act like Ctrl-Y, for repeating formatting.

Here's my simple sample:

Sub test()

'*****type something in A1

CommandBars.ExecuteMso ("Undo")
CommandBars.ExecuteMso ("Redo")
CommandBars.ExecuteMso ("Undo")
CommandBars.ExecuteMso ("Redo")

'****type something in A2, make it bold and click back into A1

CommandBars.ExecuteMso ("Repeat")

'********everything works up to here and fails on next

CommandBars.ExecuteMso ("Undo")
CommandBars.ExecuteMso ("Redo")

End Sub

Doug

"Jim Rech" wrote in message
...
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
|
|
|
|
|




Jim Rech

XL 2007 GetEnabledMso("Undo") is always True
 
The ExecuteMso("Redo") works for me.

And me too now. I tried it have a dozen times before my last post. Don't
know how I screwed that up so consistently<g.

--
Jim
"Doug Glancy" wrote in message
...
| Jim,
|
| The ExecuteMso("Redo") works for me. And then there is repeat, which
seems
| to act like Ctrl-Y, for repeating formatting.
|
| Here's my simple sample:
|
| Sub test()
|
| '*****type something in A1
|
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
|
| '****type something in A2, make it bold and click back into A1
|
| CommandBars.ExecuteMso ("Repeat")
|
| '********everything works up to here and fails on next
|
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
|
| End Sub
|
| Doug
|
| "Jim Rech" wrote in message
| ...
| 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
| |
| |
| |
| |
| |
|
|
|


Doug Glancy

XL 2007 GetEnabledMso("Undo") is always True
 
Jim,

Maybe you had typed it lower case? It's case-sensitive, I guess due to
it's XML roots.

Anyways, it was fun talking to you about this. And I'm glad the 2003
commandbars object model is still accessible!

Doug

"Jim Rech" wrote in message
...
The ExecuteMso("Redo") works for me.


And me too now. I tried it have a dozen times before my last post. Don't
know how I screwed that up so consistently<g.

--
Jim
"Doug Glancy" wrote in message
...
| Jim,
|
| The ExecuteMso("Redo") works for me. And then there is repeat, which
seems
| to act like Ctrl-Y, for repeating formatting.
|
| Here's my simple sample:
|
| Sub test()
|
| '*****type something in A1
|
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
|
| '****type something in A2, make it bold and click back into A1
|
| CommandBars.ExecuteMso ("Repeat")
|
| '********everything works up to here and fails on next
|
| CommandBars.ExecuteMso ("Undo")
| CommandBars.ExecuteMso ("Redo")
|
| End Sub
|
| Doug
|
| "Jim Rech" wrote in message
| ...
| 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
| |
| |
| |
| |
| |
|
|
|





All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com