Public Function BIP_xlsDeleteColumnRange (sSrcPath, sDestPath, sStartCol, sEndCol) ‘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.Columns(sStartCol + “:” + sEndCol).Delete
‘Save new book to Excel file
oBook.SaveAs (sDestPath)
‘Close the xls file
oExcel.Workbooks.Close()
End Function
Comments