The following VBScipt code opens the Excel file ("%ExcelFile%") and AutoFits the defined columns of the specified worksheet ("Sheet1")


Set objExcel CreateObject("Excel.Application")

Set objWorkbook objExcel.Workbooks.Open("%ExcelFile%")

objExcel.Application.Visible = True

Set objSheet objWorkbook.Sheets("Sheet1")


for col=1 to 19

objSheet.columns(col).AutoFit()

next


objWorkbook.Save

objWorkbook.Close SaveChanges = True