?
Solved

Disable a Word toolbar using VBA

Posted on 2004-04-13
1
Medium Priority
?
691 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 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …
Suggested Courses
Course of the Month15 days, 1 hour left to enroll

839 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