Prob St: To edit cells in excelsheet and password protect all used cells (Using VBScript)
- Select all cells in the excelsheet. right click, go to 'Format cells' uncheck 'Locked' in protection tab.
- Protect the excelsheet using
- Then use the following code in the vbscript to accomplish the task.
'*********************************************
Set objExcel = CreateObject("EXCEL.APPLICATION")
Set objWorkBook = objExcel.Workbooks.Open(FilePath)
objExcel.Activesheet.Unprotect "yourpassword "
' Enter you working code here
objExcel.ActiveSheet.UsedRange.Locked = true
'objExcel.Activesheet.protect "yourpassword "
'******************* end of script*****************

No comments:
Post a Comment