Quantcast
Channel: SQL Server Integration Services forum
Viewing all articles
Browse latest Browse all 24688

Excel : Sheet locked by the Windows

$
0
0

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.?


Viewing all articles
Browse latest Browse all 24688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>