Remove everything from formatting toolbar, other than Style dropdo

S

Someone

Hello,

I'm trying to create a template, so that when it is opened, the only option
to appear in the formatting toolbar is the Style dropdown (all of the other
options are hidden in the formatting toolbar). I've been trying with the
following lines for each function in the formatting toolbar and they don't
work.

With ActiveDocument
..Commandbars("Formatting").Controls("Font").Visible = False
End with

I was hoping someone can help.

Thanks in advance.
 
K

Klaus Linke

I don't have an English Word handy to test, but it probably should be
..Commandbars("Formatting").Controls("Font:").Visible = False

Using the name (caption) of the control to access it is a bit messy.
It's safer to use the Id, say

Dim myControl As CommandBarControl
For Each myControl In CommandBars("Formatting").Controls
If myControl.ID = 1728 Then ' 1728 = Font dropdown
MsgBox myControl.Caption
myControl.Visible = False
End If
Next myControl

The styles dropdown has the Id 1732, so you could change the above code to

If myControl.ID <> 1732 Then ' 1732 = Styles dropdown
myControl.Visible = False
End If

to achieve your goal.

BTW, "With ActiveDocument" was probably just for testing... since you say
you want to customize the commandbar in your template?

Regards,
Klaus
 

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