We have a small requirement to open an Excel file, run a macro, save the workbook and close Excel.

In VBS this works:
 Code:
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.Run "'D:\ExcelFile.xlsm'!Sheet1.OpenAnExistingWorkbookSet"
objExcel.DisplayAlerts = False
objExcel.Application.Save
objExcel.Application.Quit
Set objExcel = Nothing


but I seem to be unable to translate it to kix. Should not be that difficult I think but it does not execute the macro. The VBS code works but the KIX code does not work. I made some changes to the code but no success yet. The settings in Excel are unchanged between the VBS and kix code. Somehow I'm missing something. The fact that COM is not something I find easy and fully understand does not help also.

 Code:
$objExcel = CreateObject("Excel.Application")
$objExcel.Application.Run "'D:\ExcelFile.xlsm'!Sheet1.OpenAnExistingWorkbookSet"
$objExcel.DisplayAlerts = False
$objExcel.Application.Save
$objExcel.Application.Quit
$objExcel = ""
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.