Tim said:
I am putting together a template where I want to restrict
the font to Arial and the font size from 8 to 11 point.
How can I intercept the dropdowns located on the standard
'Formatting Toolbar'?
Hi Tim,
If you don't want the users to change the font, you can just remove the
font control in your template.
I'd do the same for the font size dropdown, and offer some styles with
"Arial" and the desired sizes.
If that is not an option:
Intercepting the font size control wouldn't do much good, since you can't
remove items from the dropdown's list, as far as I know.
You would need to create your own dropdown:
' run once to create the new font size dropdown:
Dim myCBDrop As CommandBarControl
Set myCBDrop =
CommandBars("Formatting").Controls.Add(Type:=msoControlDropdown)
With myCBDrop
.Caption = "Font Size"
.TooltipText = "Font Size"
.DescriptionText = "Changes" & _
"the font size of the selection"
.AddItem "8"
.AddItem "9"
.AddItem "11"
.OnAction = "SetFontSize"
End With
Sub SetFontSize()
Selection.Font.Size = _
CommandBars.ActionControl.Text
End Sub
I haven't tested this much. Perhaps you may find it necessary to write more
code (for example so that Ctrl+Shift+P sets the focus on the new control,
as it did with the built-in control).
Regards,
Klaus