I have this script working in my code, but, today, it stopped working. Here is what I have:
$Excel=new-object -comobject excel.application;
$PathXLSX = "C:\Temp\TEMP.xlsx"
$worksheetXLSX=$Excel.Workbooks.open($PathXLSX);
When I run the third line, I get this error:
You cannot call a method on a null-valued expression. At line:1 char:1
+ $worksheetXML=$Excel.workBooks.open($PathXML);
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
.Open()method.$PathXMLinstead of..XLSXSo says the error, though I don't know why the code and the error don't align... Probably a typo somewhere.