Presetting options when opening Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to open Excel and run a program that has some sensitive material. I do
not want the user to do anything without using buttons that I have developed.
I would like to make sure that all the toolbars are removed and most of the
menu items bars are not useable. I have to do this because each computer
opens Excel the same way it was shut down last. I will also had to restore
the menu options, so the next time the user is in a different Excel file they
can use them.
 
Private Sub Workbook_Open()
Worksheets(MTSheet).Select
Range("A1").Select
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Application.EnableCancelKey = xlDisabled

Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("External Data").Visible = False
Application.CommandBars("Forms").Visible = False
Application.CommandBars("Formula Auditing").Visible = False
Application.CommandBars("Picture").Visible = False
Application.CommandBars("PivotTable").Visible = False
Application.CommandBars("Protection").Visible = False
Application.CommandBars("Reviewing").Visible = False
Application.CommandBars("Text To Speech").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Watch Window").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("WordArt").Visible = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Stop Recording").Visible = False

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)


Application.CommandBars("Standard").Visible = True
End Sub
 
this will execute before the file is opened

Mike said:
Private Sub Workbook_Open()
Worksheets(MTSheet).Select
Range("A1").Select
ActiveWindow.ScrollRow = 1
ActiveWindow.ScrollColumn = 1
Application.EnableCancelKey = xlDisabled

Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Borders").Visible = False
Application.CommandBars("Chart").Visible = False
Application.CommandBars("Control Toolbox").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.CommandBars("External Data").Visible = False
Application.CommandBars("Forms").Visible = False
Application.CommandBars("Formula Auditing").Visible = False
Application.CommandBars("Picture").Visible = False
Application.CommandBars("PivotTable").Visible = False
Application.CommandBars("Protection").Visible = False
Application.CommandBars("Reviewing").Visible = False
Application.CommandBars("Text To Speech").Visible = False
Application.CommandBars("Visual Basic").Visible = False
Application.CommandBars("Watch Window").Visible = False
Application.CommandBars("Web").Visible = False
Application.CommandBars("WordArt").Visible = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Stop Recording").Visible = False

End Sub

Private Sub Workbook_BeforeClose(Cancel As Boolean)


Application.CommandBars("Standard").Visible = True
End Sub
 
that works good. what happens when they have a custome toolbar with a name we
do not know. and is there a way to clear the menu bars
 

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

Back
Top