Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 23 Sep 2008 09:44:02 -0700,    group: microsoft.public.word.vba.general        back       


Remove everything from formatting toolbar, other than Style dropdo   
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.
date: Tue, 23 Sep 2008 09:44:02 -0700   author:   Someone

Re: Remove everything from formatting toolbar, other than Style dropdo   
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



"Someone"  wrote:
> 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.
date: Tue, 23 Sep 2008 19:22:18 +0200   author:   Klaus Linke

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us