Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Disable a Word toolbar using VBA

Posted on 2004-04-13
1
686 Views
Last Modified: 2008-02-01
Using VBA, I need to disable the "Standard" toolbar for the currently active document, without affecting the normal.dot template
0
Comment
Question by:TeamWe
1 Comment
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 125 total points
ID: 10815612
Hi TeamWe,

by accessing the applications commanbars collettion you can enable or disable particular command bars
Application.CommandBars("Standard").Enabled = False

save your document. press alt+f11, this opens the vbe window, on the left you will see the project explorer (if its not visible, hit ctrl+R).
Expand the items and browse to where it says Project(your document name)- "Microsoft Word Objects" - "ThisDocument"

double click "ThisDocument" and paste the following code. change "Doc3.doc" to your document's name.
save the document and close it. the next time you open it, the standard toolbar will be missing. opening a new doc or switching to another document will make the toolbar appear, switching back to Doc3 will disable the toolbar again

--------------------
Dim WithEvents wApp As Word.Application

Private Sub Document_Open()
Set wApp = Application
Application.CommandBars("Standard").Enabled = False
End Sub

Private Sub wApp_DocumentChange()
Application.CommandBars("Standard").Enabled = IIf(ActiveDocument.Name = "Doc3.doc", 0, 1)
End Sub

Private Sub Document_Close()
Application.CommandBars("Standard").Enabled = True
End Sub
---------------------

Rajesh
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I would like to show you some basics you can do with Mailings in MS Word. It´s quite handy feature you can use for creating envelopes, labels, personalized letters etc. First question could be what is this feature good for? Mailing can really he…
A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question