PDA

View Full Version : Remove toolbars in word



Tezzies
01-25-2008, 04:04 AM
I can remove all toolbars in excel but was wondering if its possible in word.

fionabolt
01-25-2008, 04:46 AM
Why would you want to remove them? Probably better to make them not visible?

Use CommandBar.visible = False.

The CommandBar object is a member of the CommandBars collection.

Tezzies
01-25-2008, 04:59 AM
sry I am a vba muppet . you are quite right I do want to make them not visible.

I tried what you said

ie. commandbar.visible =false (method or data not found)

so i tried

Commandbars("Commandbar").visible = False (still no joy)

Any ideas?

fionabolt
01-25-2008, 05:07 AM
What command bar do you want to hide?

Use the VBA help to do a search on CommandBars and I think you'll find what you are looking for...

Tezzies
01-25-2008, 05:26 AM
all of them including the menu bar

Dave
01-25-2008, 06:03 AM
HTH. Dave

Private Sub Document_Close()
Call StartMenu
End Sub

Private Sub Document_Open()
Call StopMenu
End Sub

Sub StopMenu()
'disable file menu, edit menu, and standard toolbar
Dim cbf As CommandBar, cbe As CommandBar, cbs As CommandBar
Set cbf = Application.CommandBars("file")
cbf.Enabled = False
Set cbe = Application.CommandBars("edit")
cbe.Enabled = False
Set cbs = Application.CommandBars("standard")
cbs.Enabled = False
End Sub

Sub StartMenu()
'enable file menu, edit menu, and standard toolbar
Dim cbf As CommandBar, cbe As CommandBar, cbs As CommandBar
Set cbf = Application.CommandBars("file")
cbf.Enabled = True
Set cbe = Application.CommandBars("edit")
cbe.Enabled = True
Set cbs = Application.CommandBars("standard")
cbs.Enabled = True
End Sub

fionabolt
01-25-2008, 06:04 AM
You cannot hide the Menu Bar. It is required by the Application.

To hide all other command bars:

Option Explicit
Sub HideAllcBars()
Dim cBar As CommandBar
For Each cBar In ActiveDocument.CommandBars
If cBar.Visible = True And cBar.Protection <> msoBarNoChangeVisible Then
cBar.Visible = False
End If
Next cBar
End Sub

Tezzies
01-25-2008, 06:09 AM
Works great:beerchug: . Thanks for the help.:thumb

TonyJollans
01-27-2008, 05:44 AM
Not sure if you picked this up but the Menu Bar can be set .Enabled = False - the application does not need it on screen.

I wonder why you are doing this. Are you setting up your own toolbar as a replacement? Or are you just looking for screen space. If the latter have you considered working in full screen view?

fumei
01-28-2008, 01:53 AM
I think this is Tony's gentle way of commenting that he is not in complete agreement with undue or excessive interference with the user's interface.

TonyJollans
01-28-2008, 06:15 AM
No, no, not at all! What I *am* in disagreement with is interference by third parties (in particular, IT departments) for their own purposes, and nothing to do with user preferences or user productivity or, indeed, user anything.

In this case I was (gently :)) pointing out that one can hide the Menu Bar. And also wondering out loud what the purpose was, because fullscreen view may have been an option they hadn't considered (also available in Excel).

To go a little OT ...

I have no idea how the Ribbon will end but there are (at least) two different facets of it. The first is the great wedge of space it takes up at the top of the screen, and the second is the reduced capacity for customization. Microsoft have got it wrong before and may have got it wrong this time - it's too early to tell. Anybody customizing Word 2003 at the moment, certainly for other than personal use, should be aware that they may not be able to continue doing what they're doing when they upgrade.

fumei
01-28-2008, 01:05 PM
That is what I meant. Removing toolbars from the users IS - most likely - a decision by someone NOT the user. Few users, I would think, will remove standard toolbars. The fact is that the request is for code that imposes the removal of toolbars.

TonyJollans
01-28-2008, 02:55 PM
You are right, sorry, I'm only half with it at the moment - I do not approve.

My thoughts in posting originally were to do with the technical inaccuracy but I do not approve of messing with user's environments in this way.

fumei
01-29-2008, 11:42 AM
...and I concur. In my experience, efforts to do this type of thing really come down to a lack of training/education. They are ways to try and bypass having reasonably knowledgable users. It is "easier" to try and "solve" it with a technical solution, rather than a knowledge solution.

Users screwing things up by doing stuff from menus?

Solution A: make the menus disappear
Solution B: train and educate the users

A gets the nod most of the time.

Tezzies
01-29-2008, 04:40 PM
The reason I wanted to remove the menus ,toolbars ect is because the workbook only contains exam scores which the user can review. A userform is utilised to populate scores on a spreadsheet which is reviewed by a course supervisor. I am pretty sure the user will not deliberatly try to sabotage the program its just that the results page looks better without the menus ect. I agree that admin can cause more problems for himself by restricting users functionality. I think I proved this already by posting here and asking XLD and Co. to sort my life out. It took me about two days finally sort out my commandbars.


I would also like to mention....
Adding a macro to a command bar button using excel is seriosly flawed in my opinion for the following reason.
If I create a spreadsheet called "test1" from a template which contains a button called "close" with a link to a macro call "saveandclose" . it seems to work ok.
If I then create another spreadsheet called "test2" from the template a problem occurs. The "close" button is now linked to the macro called "saveandclose" contained within "test1". So upon clicking the "close" button I automatically look for "test1".

Plus any buttons you create will apear when the user opens another instance of excel.

The only way I found to avoid this is to create your custom buttons on open of your workbook, link them to the relevent macro , then delete them on close on your workbook. Seems a bit long winded if you ask me.

In a nutshell ,if you create a button with a link to a macro it appears in every instance of excel .

I have only been using vba for about 4 months so I could be talking booolocks.:dunno

fumei
01-29-2008, 10:23 PM
"In a nutshell ,if you create a button with a link to a macro it appears in every instance of excel ."

This is not absolutely correct.

I am not sure why all this mention of Excel, as this is the Word forum. However, your mention of the flaws seem off.

"If I then create another spreadsheet called "test2" from the template a problem occurs. The "close" button is now linked to the macro called "saveandclose" contained within "test1". "

If that is happening, then either the actual code is incorrect in some way - does it use Active? - or the code itself is being stored in the wrong place.