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



  • iSeries tutorials's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...