I am trying to run a Powershell Script which contain the below Snippet of code from (Control M -Scheduler)
$excel = New-Object -ComObject Excel.Application
$workbook=$excel.Workbooks.Open($ExcelPath,0,$false)
I am getting the below weird error
Exception calling "Open" with "3" argument(s): "Microsoft Excel cannot access the file 'Test_File.csv'. There are several possible reasons:
The file name or path does not exist. The file is being used by another program. The workbook you are trying to save has the same name as a currently open workbook."
With Same Id and Same environment when I tried to run from ISE, the code works like a charm So No idea what is going on