Home Forums SQL Server 2008 SQL Server Newbies Need to delete last row in Excel sheet using SSIS script task RE: Need to delete last row in Excel sheet using SSIS script task

  • I am trying to do something similar, but I cannot figure out how to close the excel instance from task manager. Any assistance? code snippet below

    Public Sub Main()

    '

    Dim objExcel As Object

    objExcel = CreateObject("Excel.Application")

    objExcel.Workbooks.Open("*.xls")

    objExcel.displayalerts = False

    objExcel.Sheets("*").Select()

    objExcel.rows("2:50000").delete()

    objExcel.Workbooks(1).Save()

    objExcel.Workbooks.Close(False)

    objExcel.displayalerts = True

    objExcel = Nothing