Excel instance not getting killed in task manager when using below code of VB script in SSIS package

Viewed 29

Dim excelapp as new Microsoft.Office.Interop.Excel.Application

Dim newWorkbook as Microsoft.Office.Interop.Excel.Workbook

'Get excelfile and remove password

excelapp.Visible= False

newWorkbook=excelapp.Workbooks.Open(File_Name, 0, True, 5, password, "", False, Microspft.Office.Interop.Excel.XlPlatform.xlWindows, "", True, False, 0,True, False, False)

TempExcelFileName = String.format(" {0}{1}", "", Path.GetfileName(File_Name))

TempExcelFilePath=String.Format({0}/{1}", Path.GetDirectoryName(File_Name), TempExcelFileName)

'create new excel file and remove password

newWorkbook.SaveAs(TempExcelFilePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookDefault, "", "", False, False, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type. missing)

newWorkbook.Close()

System.Runtime.InteropServices.Marshal.ReleaseComObject(newWorkbook)

excelapp.quit()

System.Runtime.InteropServices.Marshal.ReleaseComObject(excelapp)

File.Delete(File_Name)

File.Move(TempExcelFilePath, File_Name)

0 Answers
Related