Hello Everyone
I am trying to access a excel sheet from the SSIS script task. I have written following code
Public Sub Main() Dim appexcel As Object Dim newbook As Object Dim Sheet As Object Dim Connection As String = Dts.variables("User::V_FilePath").value MsgBox(Connection) appexcel = CreateObject("Excel.Application") newbook = appexcel.Workbooks.Open(Connection) Sheet = newbook.worksheets("Error") Sheet.UnProtect(Password:="ALF") newbook.Save() newbook.Close(False) appExcel.quit() Dts.TaskResult = ScriptResults.Success End Sub
I am trying to lock the cells in one of the sheet in the workbook. It's working fine to lock the cells. But, the problem is after the running the script it locks the file and after that I am not able to open it in edit mode. I only want to lock the cells. Is there anybody who can help in code and to unlock the file.?