Adding a toolbar in Powerpoint

  • Thread starter Thread starter Michelle Z
  • Start date Start date
M

Michelle Z

I have the ppa written and everything is swell except for
where the actual toolbar ends up: It makes a new row of
toolbars and is by itself. I would prefer it were next to
the Formatting toolbar. Can I just insert it into that?

Here's my current code, I have no idea how to dock the
toolbar:

<code>
' Build the command bar
Set oToolbar = CommandBars.Add(Name:=MyToolbar,
Position:=msoBarTop, Temporary:=True)

' Now add a button to the new toolbar
Set oButton = oToolbar.Controls.Add
(Type:=msoControlButton)

' And set some of the button's properties
With oButton

.DescriptionText = "Delete Notes" 'Tooltip text when
mouse if placed over button
.Caption = "DeleteNotes" 'Text if Text in Icon is
chosen
.OnAction = "Button1" 'Runs the Sub Button1() code
when clicked
.Style = msoButtonIcon ' Button displays as icon,
not text or both
.FaceId = 330 '52 is my favorite pig; chooses
icon #52 from the available Office icons

End With

' Repeat the above for as many more buttons as you
need to add
' Be sure to change the .OnAction property at least
for each new button

' You can set the toolbar position and visibility here
if you like
' By default, it'll be visible when created
oToolbar.Top = 150
oToolbar.Left = 150
oToolbar.Visible = True
</code>
 
STRONG suggestion:

Don't force the toolbar position. Users will hate you for it.

Let it appear wherever it wants to in the middle of the screen and let the
users dock it wherever it suits them.
 
Well right now it's on it's own little island and if I had
the code that allowed the user to dock it wherever and it
remained there - that would be awesome.
 
Michelle,
The Position property of the command bar object determines the docking state
while the and RowIndex property determines the position of that bar in that
docked region.
This example illustrate the use of the two properties
http://www.mvps.org/skp/off00006.htm

Note that the commandbar is recreated everytime unless the Temporary
argument of the commandbar object is set to True while creating the Command
bar.


--
Regards
Shyam Pillai

Handout Wizard
http://www.mvps.org/skp/how/
 
Back
Top