|
I have a script that opens excel and I need to be able to close at the end. So far what I have is not working. We are currently using MS Office 2003 (2007 has some issues with e-mailing documents). The below is the kix script.
?"create object" $app = CreateObject("Excel.Application") ;$app.visible = 1 ?"create wbs" ;Create the Workbooks object $file = "Y:\medicomm.xls" $wbs=$app.Workbooks.Open($file)
;$app.Range("A1:H1").insert
?"range" $app.Range("A1").Entirecolumn.NumberFormat = "mm/dd/yy" $app.Range("I1").Entirecolumn.NumberFormat = "mm/dd/yy" $app.Range("Q1").Entirecolumn.NumberFormat = "mm/dd/yy" $app.Range("T1:W1").Entirecolumn.NumberFormat = "$#,##0.00"
$app.Range("X1:Y1").EntireColumn.Delete $app.Range("A1:W1").EntireColumn.Autofit
copy "y:\medicomm.xls" "y:\medicomm-@year-@monthno-@mdayno.xls" /y $filename = "y:\medicomm-@year-@monthno-@mdayno.xls"
$app.ActiveWorkbook.SaveAs("$filename")
;IMPORTANT--YOU MUST CLOSE THE WORKBOOKS OBJECT OR ELSE ; THE EXCEL PROCESS WILL NOT TERMINATE!!! $wbs.Close
;Destroy the Worksheet, Workbooks, and Application objects $wbs = 0 $app = 0
|