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