09-25-2014, 11:43 AM
use the below function
Code:
Public Function BIP_xlsDeleteRowRange (sSrcPath, sDestPath, sStartRow, sEndRow) ‘Create Excel object
Set oExcel = CreateObject(“Excel.Application”)
‘Sets the application to raise no app alerts
‘In this case it will allow a file overwrite w/o raising a ‘yes/no’ dialog
oExcel.DisplayAlerts = False
‘Open Book in Excel
Set oBook = oExcel.Workbooks.Open(sSrcPath)
‘Set Activesheet
Set oSheet = oExcel.Activesheet
‘Delete row range
oSheet.Rows(sStartRow +”:”+ sEndRow).Delete
‘Save new book to Excel file
oBook.SaveAs (sDestPath)
‘Close the xls file
oExcel.Workbooks.Close()
End Function