Hide ribbon+command bars in 2003/2007 for specific file

D

dgold82

I am developing a workbook for users that will be using excel 2003 and 2007.
I found code that will hide the ribbon and all command bars in both 2003 and
2007. Forgive the ignorance, but it seems to be happen to even new workbooks.
I only want to hide everything for my specific file and for no others. How do
I modify my code so that it only happens in my workbook and not in others
that are open at the same time. I thought by putting the code in
"ThisWorkbook" under the file it would only affect that specific file. Here
is my current code:

Private Sub Workbook_Open()
Application.DisplayFormulaBar = False
ActiveWindow.DisplayHeadings = False
Application.DisplayFullScreen = True
Application.DisplayStatusBar = False
End Sub

Private Sub Disable_Command_Bars_1()
'This will disable all Command bars
Dim Cbar As CommandBar
For Each Cbar In Application.CommandBars
Cbar.Enabled = False
Next
End Sub

(My goal is to hide all toolbars and ribbons, status bars, formula bars and
right-clicking etc whether in 2003 or 07 so that it looks like a form it it's
own window. I still want excel to work normally outside this file)
 
H

Héctor Miguel

hi, !

ir you already have under control what to do (as mentioned in your post)...
try moving your "disabling" code in ThisWorkbook code-module to event: Workbook_WindowActivate
and the reverse actions (true to false and false to true) to the event: Workbook_WindowDeactivate

hth,
hector.

__ OP __
 
D

dgold82

Works perfectly! Thank you!

Héctor Miguel said:
hi, !

ir you already have under control what to do (as mentioned in your post)...
try moving your "disabling" code in ThisWorkbook code-module to event: Workbook_WindowActivate
and the reverse actions (true to false and false to true) to the event: Workbook_WindowDeactivate

hth,
hector.

__ OP __
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top