Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Disable a Word toolbar using VBA

Posted on 2004-04-13
1
Medium Priority
?
690 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
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.
Suggested Courses

636 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