Docking Toolbars in Powerpoint?

  • Thread starter Michelle Trayne
  • Start date
M

Michelle Trayne

I have a new toolbar that I created as an Add-in, but
everytime I load it goes back to the last line of toolbars
all by its lonesome self. In fact it looks ridiculous, and
I'd like it to cozy next to another toolbar on the same
row or at least stay put when it gets docked by the user.
I really don't know ANYTHING about VBA properties and I'm
using templates to create a PowerPoint toolbar that keeps
it floating.

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

Charles Maxson

Michelle,

You can with the RowIndex property of your commandbar. Here is an example
of putting a custom toolbar to the right of the standard toolbar in ppt:


Sub PlaceToolBar()

nRow = Application.CommandBars("Standard").RowIndex
nWidth = Application.CommandBars("Standard").Width

Set myBar = CommandBars("Custom 1")
With myBar
.RowIndex = nRow
.Left = nWidth
End With

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top