?
Solved

Disable a Word toolbar using VBA

Posted on 2004-04-13
1
Medium Priority
?
689 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
[X]
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
1 Comment
 
LVL 24

Accepted Solution

by:
R_Rajesh earned 500 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

Introduction Authors who set out to write any sort of lengthy piece for online submission—be it a long question or comment on a technical form, an article, or a substantial blog entry—often find it useful to work up a draft in an editor other t…
Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

777 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