MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Locking Down

Posted by RHargett on July 05, 2001 12:45 PM

Can you create an Excel spreadsheet and give users the right to only view it without the no option to save-as or print it.

Posted by Ben O. on July 05, 2001 1:15 PM

You can disable those options on the toolbars. Here's the syntax:

Sub LockDown()
With Application.CommandBars("File")
.Controls("Save As...").Enabled = False
.Controls("Print...").Enabled = False
End With
With Application.CommandBars("Standard")
.Controls("Save").Enabled = False
.Controls("Print").Enabled = False
End With
End Sub

You can disable all of the controls you want. Be careful though. They don't re-enable themselves when you exit the worksheet or the program, so be sure to include code to set them back to True when you close the worksheet.