We have been using this code for some time, but on Thursday it just stopped working. Throwing the above exception, I've been going through all the fixes online and nothing seems to work so I thought I'd see if anyone out there can see anything I may have missed.
The code grabs the information from excel and populates a json file.
The code:
$xlFilePath = "C:\Files\Parameters.xlsx"
$objExcel = New-Object -ComObject Excel.Application
$objExcel.Visible = $false
$objExcel.DisplayAlerts = $false
$wb = $objExcel.Workbooks.Open($xlFilePath)
#Change sheet number accordingly
$ws = $wb.Worksheets.Item(11)
$cont = "applications"
$Row=193
#local temp file location
$dwnldDir = $ws.Cells.Item($Row,$col).Value()
$masterdDir = $ws.Cells.Item($Row,$col).offset(1,0).Value()
$srcStorage = $ws.Cells.Item($Row,$col).offset(2,0).Value()
$destStorage = $ws.Cells.Item($Row,$col).offset(3,0).Value()
$rg = $ws.Cells.Item($Row,$col).offset(4,0).Value()
The error:
Exception from HRESULT: 0x800A03EC
At line:1 char:1
+ $rg = $ws.Cells.Item($Row,$col).offset(4,0).Value()
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Help .. I can't see why it would suddenly throw an exception.
Thanks in advance