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