PC Review


Reply
Thread Tools Rate Thread

Chart menu visible property

 
 
Sandy V
Guest
Posts: n/a
 
      13th May 2004
Hi,

On a worksheet there appear to be two independent settings
for -
Application.CommandBars("Chart").Visible

One when no chart is selected, and another when a chart is
active. Typically they would be False and True
respectively.

I would like to return, apply my own settings, then
correctly restore both when done, regardless as to whether
or not a chart is selected, and without having to select /
de-select a chart.

TIA,
Sandy
 
Reply With Quote
 
 
 
 
Tushar Mehta
Guest
Posts: n/a
 
      14th May 2004
OK, so what am I missing? Why not use a variable for the current value,
change it as desired and restore the setting from the variable used to
store the current setting? You already know the correct syntax for the
property. To get you started, consider the untested

Dim SavedState as Boolean
SavedState=Application.CommandBars("Chart").Visible
....

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2004

In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
(E-Mail Removed) says...
> Hi,
>
> On a worksheet there appear to be two independent settings
> for -
> Application.CommandBars("Chart").Visible
>
> One when no chart is selected, and another when a chart is
> active. Typically they would be False and True
> respectively.
>
> I would like to return, apply my own settings, then
> correctly restore both when done, regardless as to whether
> or not a chart is selected, and without having to select /
> de-select a chart.
>
> TIA,
> Sandy
>

 
Reply With Quote
 
Sandy V
Guest
Posts: n/a
 
      14th May 2004
Hi Tushar,

First of all thanks for replying.

The trouble is the chart menu visible property can change
from true / false simply by selecting / deselecting a
chart (depending on user settings). And this may occur
while my code is running. I can only return the visible
property at any one time. So the problem is how to detect
the original combination of settings, and eventually re-
apply same.

I think settings could be any of these combinations

No Chart selected | Chart selected
False | False
False | True
True | True
but not
True | False

Consider this scenario:
Original setup is False | True
Chart selected, code starts, menu visible so
SavedState = True
Chart deselected, menu not visible
Code about to terminate, apply SavedState (true)

But this is not correct, if no chart is selected the
correct setting for the menu should be visible = False

One solution would be to select / deselect a chart at an
early stage of code and detect the combination, then do
similar when done. But I prefer not to do this.

I could be missing something simple, hope I am!

Regards,
Sandy

>-----Original Message-----
>OK, so what am I missing? Why not use a variable for the
>current value, change it as desired and restore the
>setting from the variable used to store the current
>setting? You already know the correct syntax for the
>property. To get you started, consider the untested
>
>Dim SavedState as Boolean
>SavedState=Application.CommandBars("Chart").Visible
>....
>
>--
>Regards,
>
>Tushar Mehta
>www.tushar-mehta.com
>Multi-disciplinary business expertise
> + Technology skills
> = Optimal solution to your business problem
>Recipient Microsoft MVP award 2000-2004
>
>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>(E-Mail Removed) says...
>> Hi,
>>
>> On a worksheet there appear to be two independent

settings
>> for -
>> Application.CommandBars("Chart").Visible
>>
>> One when no chart is selected, and another when a chart

is
>> active. Typically they would be False and True
>> respectively.
>>
>> I would like to return, apply my own settings, then
>> correctly restore both when done, regardless as to

whether
>> or not a chart is selected, and without having to

select /
>> de-select a chart.
>>
>> TIA,
>> Sandy
>>

>.
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      15th May 2004
Sandy -

Are you messing with the visible property of the chart command bar? If
not, even if it appears and disappears during the macro, it will retain
its behavior.

The chart command bar wants to stay invisible when no chart is active,
and visible when a chart is active. If you set the visible property to a
state it doesn't like, it will stay in that condition whether or not a
chart is selected. If the visible property is already in a state it
doesn't like, changing the setting will revert it to its happy changing
state. There seems to be a third setting besides True and False for the
..Visible property: Maybe. (xlMaybe? xlWhatever.)

Since that doesn't seem very clear, I'll give an example. If the chart
is visible and so is the chart menu, making the chart menu invisible
will mean it stays hidden no matter what you select. If you select the
chart, then make the chart command bar visible, it reverts to the
witching behavior. If you then unselect the chart, the chart command bar
goes away. Make it visible now and it will stay visible.

All of the command bars that pop in and out based on the selection
function in the same manner.

But the best you can do is not change the setting at all.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Sandy V wrote:

> Hi Tushar,
>
> First of all thanks for replying.
>
> The trouble is the chart menu visible property can change
> from true / false simply by selecting / deselecting a
> chart (depending on user settings). And this may occur
> while my code is running. I can only return the visible
> property at any one time. So the problem is how to detect
> the original combination of settings, and eventually re-
> apply same.
>
> I think settings could be any of these combinations
>
> No Chart selected | Chart selected
> False | False
> False | True
> True | True
> but not
> True | False
>
> Consider this scenario:
> Original setup is False | True
> Chart selected, code starts, menu visible so
> SavedState = True
> Chart deselected, menu not visible
> Code about to terminate, apply SavedState (true)
>
> But this is not correct, if no chart is selected the
> correct setting for the menu should be visible = False
>
> One solution would be to select / deselect a chart at an
> early stage of code and detect the combination, then do
> similar when done. But I prefer not to do this.
>
> I could be missing something simple, hope I am!
>
> Regards,
> Sandy
>
>
>>-----Original Message-----
>>OK, so what am I missing? Why not use a variable for the
>>current value, change it as desired and restore the
>>setting from the variable used to store the current
>>setting? You already know the correct syntax for the
>>property. To get you started, consider the untested
>>
>>Dim SavedState as Boolean
>>SavedState=Application.CommandBars("Chart").Visible
>>....
>>
>>--
>>Regards,
>>
>>Tushar Mehta
>>www.tushar-mehta.com
>>Multi-disciplinary business expertise
>> + Technology skills
>> = Optimal solution to your business problem
>>Recipient Microsoft MVP award 2000-2004
>>
>>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>>(E-Mail Removed) says...
>>
>>>Hi,
>>>
>>>On a worksheet there appear to be two independent

>
> settings
>
>>>for -
>>>Application.CommandBars("Chart").Visible
>>>
>>>One when no chart is selected, and another when a chart

>
> is
>
>>>active. Typically they would be False and True
>>>respectively.
>>>
>>>I would like to return, apply my own settings, then
>>>correctly restore both when done, regardless as to

>
> whether
>
>>>or not a chart is selected, and without having to

>
> select /
>
>>>de-select a chart.
>>>
>>>TIA,
>>>Sandy
>>>

>>
>>.
>>


 
Reply With Quote
 
Sandy V
Guest
Posts: n/a
 
      15th May 2004
Hi Jon,

Yes I can relate to all of what you say, and thanks for
the detailed description.

Unfortunately I do want to change the combination of
visible settings for the Chart menu. I don't mind if it is
visible or not, but I do not want it changing while my
code is running. With the False | True combination this
occurs as a chart is selected or deselected.

Reason, I am highly suspicicious that the changing state,
together with other things going on with my code, causes
problems in rare situations (only with xl97). Without a
solution to detecting and applying the "combination", as
seems tbe case, I will simply disable the toolbar.

Don't suppose you have the constant values for xlMaybe &
xlWhatever, would be very useful, also xlWhenIfeelLikeIt !

Many thanks again,
Sandy

>-----Original Message-----
>Sandy -
>
>Are you messing with the visible property of the chart
>command bar? If not, even if it appears and disappears
>during the macro, it will retain its behavior.
>
>The chart command bar wants to stay invisible when no
>chart is active, and visible when a chart is active. If
>you set the visible property to a state it doesn't like,
>it will stay in that condition whether or not a chart
>is selected. If the visible property is already in a
>state it doesn't like, changing the setting will revert
>it to its happy changing state. There seems to be a third
>setting besides True and False for the
>..Visible property: Maybe. (xlMaybe? xlWhatever.)
>
>Since that doesn't seem very clear, I'll give an example.
>If the chart is visible and so is the chart menu, making
>the chart menu invisible will mean it stays hidden no
>matter what you select. If you select the chart, then
>make the chart command bar visible, it reverts to the
>witching behavior. If you then unselect the chart, the
>chart command bar goes away. Make it visible now and it
>will stay visible.
>
>All of the command bars that pop in and out based on the
>selection function in the same manner.
>
>But the best you can do is not change the setting at all.
>
>- Jon
>-------
>Jon Peltier, Microsoft Excel MVP
>Peltier Technical Services
>Tutorials and Custom Solutions
>http://PeltierTech.com/
>_______
>
>Sandy V wrote:
>
>> Hi Tushar,
>>
>> First of all thanks for replying.
>>
>> The trouble is the chart menu visible property can

change
>> from true / false simply by selecting / deselecting a
>> chart (depending on user settings). And this may occur
>> while my code is running. I can only return the visible
>> property at any one time. So the problem is how to

detect
>> the original combination of settings, and eventually re-
>> apply same.
>>
>> I think settings could be any of these combinations
>>
>> No Chart selected | Chart selected
>> False | False
>> False | True
>> True | True
>> but not
>> True | False
>>
>> Consider this scenario:
>> Original setup is False | True
>> Chart selected, code starts, menu visible so
>> SavedState = True
>> Chart deselected, menu not visible
>> Code about to terminate, apply SavedState (true)
>>
>> But this is not correct, if no chart is selected the
>> correct setting for the menu should be visible = False
>>
>> One solution would be to select / deselect a chart at

an
>> early stage of code and detect the combination, then do
>> similar when done. But I prefer not to do this.
>>
>> I could be missing something simple, hope I am!
>>
>> Regards,
>> Sandy
>>
>>
>>>-----Original Message-----
>>>OK, so what am I missing? Why not use a variable for

the
>>>current value, change it as desired and restore the
>>>setting from the variable used to store the current
>>>setting? You already know the correct syntax for the
>>>property. To get you started, consider the untested
>>>
>>>Dim SavedState as Boolean
>>>SavedState=Application.CommandBars("Chart").Visible
>>>....
>>>
>>>--
>>>Regards,
>>>
>>>Tushar Mehta
>>>www.tushar-mehta.com
>>>Multi-disciplinary business expertise
>>> + Technology skills
>>> = Optimal solution to your business problem
>>>Recipient Microsoft MVP award 2000-2004
>>>
>>>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>>>(E-Mail Removed) says...
>>>
>>>>Hi,
>>>>
>>>>On a worksheet there appear to be two independent

>>
>> settings
>>
>>>>for -
>>>>Application.CommandBars("Chart").Visible
>>>>
>>>>One when no chart is selected, and another when a

chart
>>
>> is
>>
>>>>active. Typically they would be False and True
>>>>respectively.
>>>>
>>>>I would like to return, apply my own settings, then
>>>>correctly restore both when done, regardless as to

>>
>> whether
>>
>>>>or not a chart is selected, and without having to

>>
>> select /
>>
>>>>de-select a chart.
>>>>
>>>>TIA,
>>>>Sandy
>>>>
>>>
>>>.
>>>

>
>.
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      15th May 2004
Sandy -

What kind of problems do you suspect?

- Jon

Sandy V wrote:

> Hi Jon,
>
> Yes I can relate to all of what you say, and thanks for
> the detailed description.
>
> Unfortunately I do want to change the combination of
> visible settings for the Chart menu. I don't mind if it is
> visible or not, but I do not want it changing while my
> code is running. With the False | True combination this
> occurs as a chart is selected or deselected.
>
> Reason, I am highly suspicicious that the changing state,
> together with other things going on with my code, causes
> problems in rare situations (only with xl97). Without a
> solution to detecting and applying the "combination", as
> seems tbe case, I will simply disable the toolbar.
>
> Don't suppose you have the constant values for xlMaybe &
> xlWhatever, would be very useful, also xlWhenIfeelLikeIt !
>
> Many thanks again,
> Sandy
>
>
>>-----Original Message-----
>>Sandy -
>>
>>Are you messing with the visible property of the chart
>>command bar? If not, even if it appears and disappears
>>during the macro, it will retain its behavior.
>>
>>The chart command bar wants to stay invisible when no
>>chart is active, and visible when a chart is active. If
>>you set the visible property to a state it doesn't like,
>>it will stay in that condition whether or not a chart
>>is selected. If the visible property is already in a
>>state it doesn't like, changing the setting will revert
>>it to its happy changing state. There seems to be a third
>>setting besides True and False for the
>>..Visible property: Maybe. (xlMaybe? xlWhatever.)
>>
>>Since that doesn't seem very clear, I'll give an example.
>>If the chart is visible and so is the chart menu, making
>>the chart menu invisible will mean it stays hidden no
>>matter what you select. If you select the chart, then
>>make the chart command bar visible, it reverts to the
>>witching behavior. If you then unselect the chart, the
>>chart command bar goes away. Make it visible now and it
>>will stay visible.
>>
>>All of the command bars that pop in and out based on the
>>selection function in the same manner.
>>
>>But the best you can do is not change the setting at all.
>>
>>- Jon
>>-------
>>Jon Peltier, Microsoft Excel MVP
>>Peltier Technical Services
>>Tutorials and Custom Solutions
>>http://PeltierTech.com/
>>_______
>>
>>Sandy V wrote:
>>
>>
>>>Hi Tushar,
>>>
>>>First of all thanks for replying.
>>>
>>>The trouble is the chart menu visible property can

>
> change
>
>>>from true / false simply by selecting / deselecting a
>>>chart (depending on user settings). And this may occur
>>>while my code is running. I can only return the visible
>>>property at any one time. So the problem is how to

>
> detect
>
>>>the original combination of settings, and eventually re-
>>>apply same.
>>>
>>>I think settings could be any of these combinations
>>>
>>>No Chart selected | Chart selected
>>>False | False
>>>False | True
>>>True | True
>>>but not
>>>True | False
>>>
>>>Consider this scenario:
>>>Original setup is False | True
>>>Chart selected, code starts, menu visible so
>>>SavedState = True
>>>Chart deselected, menu not visible
>>>Code about to terminate, apply SavedState (true)
>>>
>>>But this is not correct, if no chart is selected the
>>>correct setting for the menu should be visible = False
>>>
>>>One solution would be to select / deselect a chart at

>
> an
>
>>>early stage of code and detect the combination, then do
>>>similar when done. But I prefer not to do this.
>>>
>>>I could be missing something simple, hope I am!
>>>
>>>Regards,
>>>Sandy
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>OK, so what am I missing? Why not use a variable for

>
> the
>
>>>>current value, change it as desired and restore the
>>>>setting from the variable used to store the current
>>>>setting? You already know the correct syntax for the
>>>>property. To get you started, consider the untested
>>>>
>>>>Dim SavedState as Boolean
>>>>SavedState=Application.CommandBars("Chart").Visible
>>>>....
>>>>
>>>>--
>>>>Regards,
>>>>
>>>>Tushar Mehta
>>>>www.tushar-mehta.com
>>>>Multi-disciplinary business expertise
>>>>+ Technology skills
>>>> = Optimal solution to your business problem
>>>>Recipient Microsoft MVP award 2000-2004
>>>>
>>>>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>>>>(E-Mail Removed) says...
>>>>
>>>>
>>>>>Hi,
>>>>>
>>>>>On a worksheet there appear to be two independent
>>>
>>>settings
>>>
>>>
>>>>>for -
>>>>>Application.CommandBars("Chart").Visible
>>>>>
>>>>>One when no chart is selected, and another when a

>
> chart
>
>>>is
>>>
>>>
>>>>>active. Typically they would be False and True
>>>>>respectively.
>>>>>
>>>>>I would like to return, apply my own settings, then
>>>>>correctly restore both when done, regardless as to
>>>
>>>whether
>>>
>>>
>>>>>or not a chart is selected, and without having to
>>>
>>>select /
>>>
>>>
>>>>>de-select a chart.
>>>>>
>>>>>TIA,
>>>>>Sandy
>>>>>
>>>>
>>>>.
>>>>

>>
>>.
>>


 
Reply With Quote
 
Sandy V
Guest
Posts: n/a
 
      15th May 2004
Hi Jon,

I think the problem(s) relate to redrawing chart after a
format change to a chart item, in particular colour.
Having said that, the chart appears to redraw perfectly,
but later when another chart item is selected the entire
chart object can apparently disappear leaving only
selection handles.

But move something over the chart and it is "repainted"
under the moving object (eg a msgbox or by scrolling). In
worst case XL can crash, even before a class event I have
created to trap selection is activated. This is not
related to screenupdating or enableevents (although I've
tried reversing these to in various places, also
experimented with DoEvents).

A more detailed description would be far too long to place
here. However disabling the chart menu seems to reduce
occurrence, which in any case is confined to certain
charts (I don't mean "types") and after a particular chain
of actions (xl97 only).

If this means anything to you I'm all ears !

Regards,
Sandy

>-----Original Message-----
>Sandy -
>
>What kind of problems do you suspect?
>
>- Jon
>
>Sandy V wrote:
>
>> Hi Jon,
>>
>> Yes I can relate to all of what you say, and thanks for
>> the detailed description.
>>
>> Unfortunately I do want to change the combination of
>> visible settings for the Chart menu. I don't mind if it

is
>> visible or not, but I do not want it changing while my
>> code is running. With the False | True combination this
>> occurs as a chart is selected or deselected.
>>
>> Reason, I am highly suspicicious that the changing

state,
>> together with other things going on with my code,

causes
>> problems in rare situations (only with xl97). Without a
>> solution to detecting and applying the "combination",

as
>> seems tbe case, I will simply disable the toolbar.
>>
>> Don't suppose you have the constant values for xlMaybe

&
>> xlWhatever, would be very useful, also

xlWhenIfeelLikeIt !
>>
>> Many thanks again,
>> Sandy
>>
>>
>>>-----Original Message-----
>>>Sandy -
>>>
>>>Are you messing with the visible property of the chart
>>>command bar? If not, even if it appears and disappears
>>>during the macro, it will retain its behavior.
>>>
>>>The chart command bar wants to stay invisible when no
>>>chart is active, and visible when a chart is active. If
>>>you set the visible property to a state it doesn't like,
>>>it will stay in that condition whether or not a chart
>>>is selected. If the visible property is already in a
>>>state it doesn't like, changing the setting will revert
>>>it to its happy changing state. There seems to be a

third
>>>setting besides True and False for the
>>>..Visible property: Maybe. (xlMaybe? xlWhatever.)
>>>
>>>Since that doesn't seem very clear, I'll give an

example.
>>>If the chart is visible and so is the chart menu, making
>>>the chart menu invisible will mean it stays hidden no
>>>matter what you select. If you select the chart, then
>>>make the chart command bar visible, it reverts to the
>>>witching behavior. If you then unselect the chart, the
>>>chart command bar goes away. Make it visible now and it
>>>will stay visible.
>>>
>>>All of the command bars that pop in and out based on the
>>>selection function in the same manner.
>>>
>>>But the best you can do is not change the setting at

all.
>>>
>>>- Jon
>>>-------
>>>Jon Peltier, Microsoft Excel MVP
>>>Peltier Technical Services
>>>Tutorials and Custom Solutions
>>>http://PeltierTech.com/
>>>_______
>>>
>>>Sandy V wrote:
>>>
>>>
>>>>Hi Tushar,
>>>>
>>>>First of all thanks for replying.
>>>>
>>>>The trouble is the chart menu visible property can

>>
>> change
>>
>>>>from true / false simply by selecting / deselecting a
>>>>chart (depending on user settings). And this may occur
>>>>while my code is running. I can only return the

visible
>>>>property at any one time. So the problem is how to

>>
>> detect
>>
>>>>the original combination of settings, and eventually

re-
>>>>apply same.
>>>>
>>>>I think settings could be any of these combinations
>>>>
>>>>No Chart selected | Chart selected
>>>>False | False
>>>>False | True
>>>>True | True
>>>>but not
>>>>True | False
>>>>
>>>>Consider this scenario:
>>>>Original setup is False | True
>>>>Chart selected, code starts, menu visible so
>>>>SavedState = True
>>>>Chart deselected, menu not visible
>>>>Code about to terminate, apply SavedState (true)
>>>>
>>>>But this is not correct, if no chart is selected the
>>>>correct setting for the menu should be visible = False
>>>>
>>>>One solution would be to select / deselect a chart at

>>
>> an
>>
>>>>early stage of code and detect the combination, then

do
>>>>similar when done. But I prefer not to do this.
>>>>
>>>>I could be missing something simple, hope I am!
>>>>
>>>>Regards,
>>>>Sandy
>>>>
>>>>
>>>>
>>>>>-----Original Message-----
>>>>>OK, so what am I missing? Why not use a variable for

>>
>> the
>>
>>>>>current value, change it as desired and restore the
>>>>>setting from the variable used to store the current
>>>>>setting? You already know the correct syntax for the
>>>>>property. To get you started, consider the untested
>>>>>
>>>>>Dim SavedState as Boolean
>>>>>SavedState=Application.CommandBars("Chart").Visible
>>>>>....
>>>>>
>>>>>--
>>>>>Regards,
>>>>>
>>>>>Tushar Mehta
>>>>>www.tushar-mehta.com
>>>>>Multi-disciplinary business expertise
>>>>>+ Technology skills
>>>>> = Optimal solution to your business problem
>>>>>Recipient Microsoft MVP award 2000-2004
>>>>>
>>>>>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>>>>>(E-Mail Removed) says...
>>>>>
>>>>>
>>>>>>Hi,
>>>>>>
>>>>>>On a worksheet there appear to be two independent
>>>>
>>>>settings
>>>>
>>>>
>>>>>>for -
>>>>>>Application.CommandBars("Chart").Visible
>>>>>>
>>>>>>One when no chart is selected, and another when a

>>
>> chart
>>
>>>>is
>>>>
>>>>
>>>>>>active. Typically they would be False and True
>>>>>>respectively.
>>>>>>
>>>>>>I would like to return, apply my own settings, then
>>>>>>correctly restore both when done, regardless as to
>>>>
>>>>whether
>>>>
>>>>
>>>>>>or not a chart is selected, and without having to
>>>>
>>>>select /
>>>>
>>>>
>>>>>>de-select a chart.
>>>>>>
>>>>>>TIA,
>>>>>>Sandy
>>>>>>
>>>>>
>>>>>.
>>>>>
>>>
>>>.
>>>

>
>.
>

 
Reply With Quote
 
Jon Peltier
Guest
Posts: n/a
 
      15th May 2004
Sandy -

It means you've figured out a workaround that someone who merely
followed help and the object model wouldn't have found. I guess the
trick is to determine the visible state of the charts command bar with
and without a chart selected, noting this, then resetting it as
appropriate at the end. I think I described "appropriate" in an earlier
post.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Peltier Technical Services
Tutorials and Custom Solutions
http://PeltierTech.com/
_______

Sandy V wrote:

> Hi Jon,
>
> I think the problem(s) relate to redrawing chart after a
> format change to a chart item, in particular colour.
> Having said that, the chart appears to redraw perfectly,
> but later when another chart item is selected the entire
> chart object can apparently disappear leaving only
> selection handles.
>
> But move something over the chart and it is "repainted"
> under the moving object (eg a msgbox or by scrolling). In
> worst case XL can crash, even before a class event I have
> created to trap selection is activated. This is not
> related to screenupdating or enableevents (although I've
> tried reversing these to in various places, also
> experimented with DoEvents).
>
> A more detailed description would be far too long to place
> here. However disabling the chart menu seems to reduce
> occurrence, which in any case is confined to certain
> charts (I don't mean "types") and after a particular chain
> of actions (xl97 only).
>
> If this means anything to you I'm all ears !
>
> Regards,
> Sandy
>
>
>>-----Original Message-----
>>Sandy -
>>
>>What kind of problems do you suspect?
>>
>>- Jon
>>
>>Sandy V wrote:
>>
>>
>>>Hi Jon,
>>>
>>>Yes I can relate to all of what you say, and thanks for
>>>the detailed description.
>>>
>>>Unfortunately I do want to change the combination of
>>>visible settings for the Chart menu. I don't mind if it

>
> is
>
>>>visible or not, but I do not want it changing while my
>>>code is running. With the False | True combination this
>>>occurs as a chart is selected or deselected.
>>>
>>>Reason, I am highly suspicicious that the changing

>
> state,
>
>>>together with other things going on with my code,

>
> causes
>
>>>problems in rare situations (only with xl97). Without a
>>>solution to detecting and applying the "combination",

>
> as
>
>>>seems tbe case, I will simply disable the toolbar.
>>>
>>>Don't suppose you have the constant values for xlMaybe

>
> &
>
>>>xlWhatever, would be very useful, also

>
> xlWhenIfeelLikeIt !
>
>>>Many thanks again,
>>>Sandy
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>Sandy -
>>>>
>>>>Are you messing with the visible property of the chart
>>>>command bar? If not, even if it appears and disappears
>>>>during the macro, it will retain its behavior.
>>>>
>>>>The chart command bar wants to stay invisible when no
>>>>chart is active, and visible when a chart is active. If
>>>>you set the visible property to a state it doesn't like,
>>>>it will stay in that condition whether or not a chart
>>>>is selected. If the visible property is already in a
>>>>state it doesn't like, changing the setting will revert
>>>>it to its happy changing state. There seems to be a

>
> third
>
>>>>setting besides True and False for the
>>>>..Visible property: Maybe. (xlMaybe? xlWhatever.)
>>>>
>>>>Since that doesn't seem very clear, I'll give an

>
> example.
>
>>>>If the chart is visible and so is the chart menu, making
>>>>the chart menu invisible will mean it stays hidden no
>>>>matter what you select. If you select the chart, then
>>>>make the chart command bar visible, it reverts to the
>>>>witching behavior. If you then unselect the chart, the
>>>>chart command bar goes away. Make it visible now and it
>>>>will stay visible.
>>>>
>>>>All of the command bars that pop in and out based on the
>>>>selection function in the same manner.
>>>>
>>>>But the best you can do is not change the setting at

>
> all.
>
>>>>- Jon
>>>>-------
>>>>Jon Peltier, Microsoft Excel MVP
>>>>Peltier Technical Services
>>>>Tutorials and Custom Solutions
>>>>http://PeltierTech.com/
>>>>_______
>>>>
>>>>Sandy V wrote:
>>>>
>>>>
>>>>
>>>>>Hi Tushar,
>>>>>
>>>>>First of all thanks for replying.
>>>>>
>>>>>The trouble is the chart menu visible property can
>>>
>>>change
>>>
>>>
>>>>>from true / false simply by selecting / deselecting a
>>>>
>>>>>chart (depending on user settings). And this may occur
>>>>>while my code is running. I can only return the

>
> visible
>
>>>>>property at any one time. So the problem is how to
>>>
>>>detect
>>>
>>>
>>>>>the original combination of settings, and eventually

>
> re-
>
>>>>>apply same.
>>>>>
>>>>>I think settings could be any of these combinations
>>>>>
>>>>>No Chart selected | Chart selected
>>>>>False | False
>>>>>False | True
>>>>>True | True
>>>>>but not
>>>>>True | False
>>>>>
>>>>>Consider this scenario:
>>>>>Original setup is False | True
>>>>>Chart selected, code starts, menu visible so
>>>>>SavedState = True
>>>>>Chart deselected, menu not visible
>>>>>Code about to terminate, apply SavedState (true)
>>>>>
>>>>>But this is not correct, if no chart is selected the
>>>>>correct setting for the menu should be visible = False
>>>>>
>>>>>One solution would be to select / deselect a chart at
>>>
>>>an
>>>
>>>
>>>>>early stage of code and detect the combination, then

>
> do
>
>>>>>similar when done. But I prefer not to do this.
>>>>>
>>>>>I could be missing something simple, hope I am!
>>>>>
>>>>>Regards,
>>>>>Sandy
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>-----Original Message-----
>>>>>>OK, so what am I missing? Why not use a variable for
>>>
>>>the
>>>
>>>
>>>>>>current value, change it as desired and restore the
>>>>>>setting from the variable used to store the current
>>>>>>setting? You already know the correct syntax for the
>>>>>>property. To get you started, consider the untested
>>>>>>
>>>>>>Dim SavedState as Boolean
>>>>>>SavedState=Application.CommandBars("Chart").Visible
>>>>>>....
>>>>>>
>>>>>>--
>>>>>>Regards,
>>>>>>
>>>>>>Tushar Mehta
>>>>>>www.tushar-mehta.com
>>>>>>Multi-disciplinary business expertise
>>>>>>+ Technology skills
>>>>>> = Optimal solution to your business problem
>>>>>>Recipient Microsoft MVP award 2000-2004
>>>>>>
>>>>>>In article <c7e301c438e6$642311f0$(E-Mail Removed)>,
>>>>>>(E-Mail Removed) says...
>>>>>>
>>>>>>
>>>>>>
>>>>>>>Hi,
>>>>>>>
>>>>>>>On a worksheet there appear to be two independent
>>>>>
>>>>>settings
>>>>>
>>>>>
>>>>>
>>>>>>>for -
>>>>>>>Application.CommandBars("Chart").Visible
>>>>>>>
>>>>>>>One when no chart is selected, and another when a
>>>
>>>chart
>>>
>>>
>>>>>is
>>>>>
>>>>>
>>>>>
>>>>>>>active. Typically they would be False and True
>>>>>>>respectively.
>>>>>>>
>>>>>>>I would like to return, apply my own settings, then
>>>>>>>correctly restore both when done, regardless as to
>>>>>
>>>>>whether
>>>>>
>>>>>
>>>>>
>>>>>>>or not a chart is selected, and without having to
>>>>>
>>>>>select /
>>>>>
>>>>>
>>>>>
>>>>>>>de-select a chart.
>>>>>>>
>>>>>>>TIA,
>>>>>>>Sandy
>>>>>>>
>>>>>>
>>>>>>.
>>>>>>
>>>>
>>>>.
>>>>

>>
>>.
>>


 
Reply With Quote
 
Sandy V
Guest
Posts: n/a
 
      17th May 2004
Hi Jon,

I've noticed that charts in xl97 are, how can I put
it, "sensitive" and sometimes require a little extra
attention (maybe SP1 more so than SP2).

Regards,
Sandy

>-----Original Message-----
>Sandy -
>
>It means you've figured out a workaround that someone who
>merely followed help and the object model wouldn't have
>found. I guess the trick is to determine the visible
>state of the charts command bar with and without a chart
>selected, noting this, then resetting it as appropriate
>at the end. I think I described "appropriate" in an
>earlier post.
>
>- Jon
>-------
>Jon Peltier, Microsoft Excel MVP
>Peltier Technical Services
>Tutorials and Custom Solutions
>http://PeltierTech.com/
>_______

<snip>
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 Menu Items Visible Property Bruce Microsoft Outlook VBA Programming 3 21st Jan 2009 02:29 PM
property with defalut value will not be called in auto-generated code, and how to make a property only visible at design time? Ryan Liu Microsoft C# .NET 2 27th Aug 2006 03:09 PM
Visible Property =?Utf-8?B?R2xlbm4=?= Microsoft Access Getting Started 3 25th May 2004 05:18 PM
ComboBox SelectedIndex Property Changes when changing Visible property mike Microsoft VB .NET 1 24th Oct 2003 09:51 PM
Re: .Visible Property Jollynicechap Microsoft Excel Programming 1 8th Jul 2003 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:36 PM.