Manage Learn to apply best practices and optimize your operations.

Secure Microsoft Excel spreadsheets with LotusScript

Want to protect your Microsoft Excel spreadsheets from tampering? This LotusScript code from member Prasad Knair programmatically lets you secure a Microsoft Excel file with a password and prohibit what columns can be edited.

Want to protect Microsoft Excel spreadsheets from tampering? This LotusScript code only allows users to edit columns that you specify as permitted. Other columns can be locked programmatically, and the Microsoft Excel file will be protected with a password. The only way for the secured columns to be edited is for the user to know the password and edit them after entering it.

'Setting the Excel object.  
Set ExcelApp = CreateObject("Excel.Application")
Set ExcelWorkbook = 
Set ExcelWorksheet = 
' You can enter the values and once 
the entry is over lock the columns.
With ExcelWorksheet 
' .Range("A1:B1").Select
.Range("A1").Value ="Prasad"
.Range("B1").Value ="Lekshmi"
End With
ExcelWorksheet.Protect Password="1234" 
'  You just need one line to protect excel sheet from tampering.
Set ExcelApp=Nothing

Do you have comments on this tip? Let us know.

Related information from


Dig Deeper on LotusScript



  • Favorite iSeries cheat sheets

    Here you'll find a collection of valuable cheat sheets gathered from across the iSeries/ community. These cheat ...

  • HTML cheat sheet

    This is a really cool cheat sheet if you're looking to learn more about HTML. You'll find just about everything you every wanted ...

  • Carol Woodbury: Security

    Carol Woodbury