Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / PowerPoint / January 2006



Tip: Looking for answers? Try searching our database.

CommandBar Popup: How to recreate the submenu

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jim Gordon MVP - 16 Jan 2006 20:13 GMT
Here's the setup:

I created a toolbar called "BWTools" and I want to add the functionality
that comes with a built-in toolbar command along with that command's
pop-up submenu.

Both of the following syntax statements successfully add the desired
control to the existing "BWTools" toolbar:

Set MyBar = CommandBars("BWTools").Controls.Add(Id:=742)
or
Application.CommandBars("BWTools").Controls.Add Type:=msoControlPopup,
Id:=742, Before:=2

At this point I have the desired control and an empty stub that's
waiting for the submenu items.

The following syntax adds submenu items successfully (and even adds
pictures to the submenu items which I thought was impossible)

With MyBar
    .Controls.Add Type:=msoControlButton, Id:=2, Before:=1
    .Controls.Add Type:=msoControlButton, Id:=3, Before:=2
End With

So far so good. But I want to use the commands that would normally be on
this control in the pop-up submenu.

How do I figure out the ID numbers of the items that are on control 742
when you drag it to a toolbar? It is this command: (Toolbars > Customize
Menus and Toolbars > Commands > Grayscale settings)

-Jim

Signature

Jim Gordon
Mac MVP
MVP FAQ
<http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpfaqs>

Steve Rindsberg - 17 Jan 2006 01:46 GMT
> Here's the setup:
>
[quoted text clipped - 29 lines]
>
> -Jim

Simplest way I know is like this:

Manually using the customize feature
  - create a new commandbar named Test
  - add the b/w options button to it

Then run this:

Sub TellJim()
   Dim x As Long
   Dim oCtl As CommandBarControl
   
   ' Get a reference to the first control on the Test toolbar
   Set oCtl = Application.CommandBars("Test").Controls(1)

   ' The control is a popup so it has its own .Controls collection
   ' That's what you're after:
   For x = 1 To oCtl.Controls.Count
       Debug.Print oCtl.Controls(x).Caption & vbTab & oCtl.Controls(x).Id
   Next
End Sub

================================================
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Jim Gordon MVP - 17 Jan 2006 02:25 GMT
You're awesome, Steve!

Here's the result:
&Automatic  2733
&Grayscale  2739
&Light Grayscale    2742
&Inverse Grayscale  2740
Gra&y with White Fill   2738
Blac&k with Grayscale Fill  2735
Bla&ck with White Fill  2736
&Black  2734
&White  2741
&Don't Show 2737

-Jim

Signature

Jim Gordon
Mac MVP
MVP FAQ
<http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpfaqs>

>>Here's the setup:
>>
[quoted text clipped - 57 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 17 Jan 2006 16:34 GMT
> You're awesome, Steve!

Herself says you spelled that wrong.  She says it's "awe-ful"
<g>

I can't swear to the IDs but the results look pretty much like what I got here
when I tried it.

You can also extend the same idea and iterate through the whole
Application.CommandBars collection to get *everything* but this seems a lot
easier for a quickie.

> Here's the result:
> &Automatic  2733
[quoted text clipped - 9 lines]
>
> -Jim

================================================
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
Jim Gordon MVP - 18 Jan 2006 05:33 GMT
Well it worked just fine and my commandbar is working exactly the way I
hoped it would on Macintosh PowerPoint 98, 2001, X, and 2004.

You would think the macro would work for Windows PowerPoint 2003, but
alas, I will have to write special code for that puppy.

Signature

Jim Gordon
Mac MVP
MVP FAQ
<http://mvp.support.microsoft.com/default.aspx?scid=fh;EN-US;mvpfaqs>

>>You're awesome, Steve!
>
[quoted text clipped - 27 lines]
> PPTools:  www.pptools.com
> ================================================
Steve Rindsberg - 18 Jan 2006 16:24 GMT
> Well it worked just fine and my commandbar is working exactly the way I
> hoped it would on Macintosh PowerPoint 98, 2001, X, and 2004.
>
> You would think the macro would work for Windows PowerPoint 2003, but
> alas, I will have to write special code for that puppy.

What've you run into there?

And you do know that you can simply set the B/W values you want directly,
right?  It's one of the various read/write properties of a shape.

================================================
Steve Rindsberg, PPT MVP
PPT FAQ:  www.pptfaq.com
PPTools:  www.pptools.com
================================================
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.