PC Review


Reply
Thread Tools Rate Thread

Built-in Commandbar, can't find the right one

 
 
Ken Jones
Guest
Posts: n/a
 
      3rd Dec 2007
In Excel 2003 I'm trying to add a custom button to several chart related
commandbars. The code I'm using is littered all over the Internet and works
well. For example...

Dim menuCtl As CommandBarButton
Set menuCtl = CommandBars(strName).Controls.Add(msoControlButton, , , , True)
With menuCtl
.Caption = "Do It Mister!"
.OnAction = "DoClickThing"
End With

As long as I provide the correct "strName" string value to grab the correct
commandbar, it works great. The problem is that I can't seem to find the
correct commandbar for chart legends or chart titles. I would think that the
legend, the proper commandbar would be "Format Legend Entry", but I've
noticed that when I iterate on the controls for that commandbar, it lists two
buttons that aren't on the menu displayed, which are "Hide Detail" and "Show
Detail". To be more clear, when I right click on the chart legend, here are
the optionds displayed in the menu that comes up:

Format Legend...
Clear

But if I cycle through the controls on the "Format Legend Entry" I get the
following button captions:

Format Object
Hide Detial
Show Detail
Clear

So once the question is, what's the proper name of the menu I'm looking for?

Thanks,

Ken
 
Reply With Quote
 
 
 
 
Dale Fye
Guest
Posts: n/a
 
      3rd Dec 2007
Ken,

My guess is that you have found what you are looking for but that the other
two buttons are only visible under certain circumstances.

Try adding your button to that menubar and then see whether it shows up when
you right click on the legend or under whatever other circumstance you expect
that commandbar to show itself.

Dale


--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"Ken Jones" wrote:

> In Excel 2003 I'm trying to add a custom button to several chart related
> commandbars. The code I'm using is littered all over the Internet and works
> well. For example...
>
> Dim menuCtl As CommandBarButton
> Set menuCtl = CommandBars(strName).Controls.Add(msoControlButton, , , , True)
> With menuCtl
> .Caption = "Do It Mister!"
> .OnAction = "DoClickThing"
> End With
>
> As long as I provide the correct "strName" string value to grab the correct
> commandbar, it works great. The problem is that I can't seem to find the
> correct commandbar for chart legends or chart titles. I would think that the
> legend, the proper commandbar would be "Format Legend Entry", but I've
> noticed that when I iterate on the controls for that commandbar, it lists two
> buttons that aren't on the menu displayed, which are "Hide Detail" and "Show
> Detail". To be more clear, when I right click on the chart legend, here are
> the optionds displayed in the menu that comes up:
>
> Format Legend...
> Clear
>
> But if I cycle through the controls on the "Format Legend Entry" I get the
> following button captions:
>
> Format Object
> Hide Detial
> Show Detail
> Clear
>
> So once the question is, what's the proper name of the menu I'm looking for?
>
> Thanks,
>
> Ken

 
Reply With Quote
 
Ken Jones
Guest
Posts: n/a
 
      3rd Dec 2007
Dale,

I've actually tried that. If I run the same code on the "Object/Plot" or
"Plot Area" or "Series" Commandbars, it's great! The button appears and I
can code a handler method for it. But it doesn't work for say the "Format
Axis", "Format Legend Entry", or "Trendline" menus. That's why it seems that
I'm not getting hold of the correct menu item. Earlier I made a stab at
running through all the Commandbars and adding the button to ALL of them, and
even then, I don't think it appeared on the three commandbars I mention
above. I wonder if there's something fundamentally different about those
popup menus, that they aren't really a "CommandBar" object?

Ken

"Dale Fye" wrote:

> Ken,
>
> My guess is that you have found what you are looking for but that the other
> two buttons are only visible under certain circumstances.
>
> Try adding your button to that menubar and then see whether it shows up when
> you right click on the legend or under whatever other circumstance you expect
> that commandbar to show itself.
>
> Dale
>
>
> --
> Don''t forget to rate the post if it was helpful!
>
> Email address is not valid.
> Please reply to newsgroup only.
>
>
> "Ken Jones" wrote:
>
> > In Excel 2003 I'm trying to add a custom button to several chart related
> > commandbars. The code I'm using is littered all over the Internet and works
> > well. For example...
> >
> > Dim menuCtl As CommandBarButton
> > Set menuCtl = CommandBars(strName).Controls.Add(msoControlButton, , , , True)
> > With menuCtl
> > .Caption = "Do It Mister!"
> > .OnAction = "DoClickThing"
> > End With
> >
> > As long as I provide the correct "strName" string value to grab the correct
> > commandbar, it works great. The problem is that I can't seem to find the
> > correct commandbar for chart legends or chart titles. I would think that the
> > legend, the proper commandbar would be "Format Legend Entry", but I've
> > noticed that when I iterate on the controls for that commandbar, it lists two
> > buttons that aren't on the menu displayed, which are "Hide Detail" and "Show
> > Detail". To be more clear, when I right click on the chart legend, here are
> > the optionds displayed in the menu that comes up:
> >
> > Format Legend...
> > Clear
> >
> > But if I cycle through the controls on the "Format Legend Entry" I get the
> > following button captions:
> >
> > Format Object
> > Hide Detial
> > Show Detail
> > Clear
> >
> > So once the question is, what's the proper name of the menu I'm looking for?
> >
> > Thanks,
> >
> > Ken

 
Reply With Quote
 
Bill Renaud
Guest
Posts: n/a
 
      4th Dec 2007
Playing around with my CommandBarTests workbook (which lists CommandBars,
their positions, Type, etc.), I think you may be looking for a popup
commandbar (msoBarTypePopup) named "Chart".

--
Regards,
Bill Renaud



 
Reply With Quote
 
Andrei Smolin [Add-in Express]
Guest
Posts: n/a
 
      4th Dec 2007
You can use our free Built-in Controls Scanner to find more details about
built-in command bars and their controls.

Download it at http://www.add-in-express.com/downlo...ls-scanner.php

Regards from Belarus,

Andrei Smolin
Add-in Express Team Leader
www.add-in-express.com


"Bill Renaud" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Playing around with my CommandBarTests workbook (which lists CommandBars,
> their positions, Type, etc.), I think you may be looking for a popup
> commandbar (msoBarTypePopup) named "Chart".
>
> --
> Regards,
> Bill Renaud
>
>
>



 
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
XP CD can't find hard drive in new built PC Dave (from the UK) DIY PC 4 7th Apr 2006 11:07 PM
Find/Replace built-in dialog in XP kevboy Microsoft Excel Programming 2 19th Dec 2005 08:59 PM
Access's built in find not working =?Utf-8?B?bXRhbWF0dA==?= Microsoft Access Forms 1 21st Jun 2005 01:58 PM
Commandbar - how to find out which msoCommandButton was pressed =?Utf-8?B?Sm9zZXBoVkJB?= Microsoft Excel Programming 5 1st Feb 2005 01:32 PM
Built-in FIND() function in Access? angelasg@comcast.net Microsoft Access 4 11th Apr 2004 05:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:54 AM.