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: Mon, 6 Feb 2006 13:35:30 -0800,    group: microsoft.public.word.vba.customization        back       


Using Auto macros to Protect Toolbar   
Cindy M. was helping me in another newsgroup on this, but I thought I should 
move my quesion here, to a more appropriate category.

I'm still trying to protect a toolbar from being turned off by users, 
regardless of the template they use to create a document in Word.  I have put 
the following code in the Normal project in VBA:

Sub AutoNew()
CommandBars("IPG").Visible = True
CommandBars("IPG").Protection = msoBarNoChangeVisible
End Sub

Sub AutoOpen()
CommandBars("IPG").Visible = True
CommandBars("IPG").Protection = msoBarNoChangeVisible
End Sub

It seems to be working, regardless of the template that is used.  I would 
have thought that this code would only work for documents created using the 
normal.dot template.  Why is it working, even if a user creates a new 
document using, for example, RequestForm.dot?

My other question is that the above code is working for every document 
except for Document.1 that is automatically created when Word opens.  I can't 
seem to get the above code to work in Sub AutoExec(), which I think would 
take care of the Document1.doc.  Will the above code not work in AutoExec().  
Thanks for continued help on this - I'm getting closer. : )
date: Mon, 6 Feb 2006 13:35:30 -0800   author:   Alex

Re: Using Auto macros to Protect Toolbar   
If you have the code in the Normal Template, by default the customization
affects everything which doesn't have its own explicit overriding
customization. To only affect individual documents, or documents based on a
particular template, place the code in the document, or template, and set
CustomizationContext accordingly.

Your code will run whenever a document based on Normal is created (except,
as you note, for the default document created at startup) or opened. It will
not run when other documents are created or opened. However, once it has
run, you have the toolbar whatever you open or create later.

You should probably be putting the code in the template you want it to
affect (but still set CustomizationContext) and also removing the toolbar on
close. As I don't know exactly when you want the toolbar displayed and not,
I can't be more precise.

--
Enjoy,
Tony


"Alex"  wrote in message
news:02BFD2B2-D3DC-44DC-A708-4C287267FE10@microsoft.com...
> Cindy M. was helping me in another newsgroup on this, but I thought I
should
> move my quesion here, to a more appropriate category.
>
> I'm still trying to protect a toolbar from being turned off by users,
> regardless of the template they use to create a document in Word.  I have
put
> the following code in the Normal project in VBA:
>
> Sub AutoNew()
> CommandBars("IPG").Visible = True
> CommandBars("IPG").Protection = msoBarNoChangeVisible
> End Sub
>
> Sub AutoOpen()
> CommandBars("IPG").Visible = True
> CommandBars("IPG").Protection = msoBarNoChangeVisible
> End Sub
>
> It seems to be working, regardless of the template that is used.  I would
> have thought that this code would only work for documents created using
the
> normal.dot template.  Why is it working, even if a user creates a new
> document using, for example, RequestForm.dot?
>
> My other question is that the above code is working for every document
> except for Document.1 that is automatically created when Word opens.  I
can't
> seem to get the above code to work in Sub AutoExec(), which I think would
> take care of the Document1.doc.  Will the above code not work in
AutoExec().
> Thanks for continued help on this - I'm getting closer. : )
>
date: Tue, 7 Feb 2006 13:23:33 -0000   author:   Tony Jollans My Forename at My Surname dot com

Google
 
Web ureader.com


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