0

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

Norrin Rad
  • 881
  • 2
  • 18
  • 42
  • Did you try the suggested fixes here? https://stackoverflow.com/questions/7099770/hresult-0x800a03ec-on-worksheet-range – tukan Aug 20 '18 at 09:20
  • @tukan thanks for the reply, tried those, just confirmed and even tried the classic reboot, but no progress :( – Norrin Rad Aug 20 '18 at 09:57
  • Did you check any updates that could cause that? – tukan Aug 20 '18 at 10:29
  • @tukan I just rolled my machine back to last week, before the windows updates which ran back end of last week, this seems to have resolved the issue. I'm checking a colleagues machine to see what updates were installed and I'll run those separately to see what breaks it .. thanks so much for your help, can mark that as the solution :) – Norrin Rad Aug 20 '18 at 10:31
  • p.s. I can see `$Row` has a value, but what about `$col` ? – Theo Aug 20 '18 at 11:13
  • Ok, it would be nice for others to know which patch was that in specific :). Thank you. – tukan Aug 20 '18 at 13:16

1 Answers1

0

As usual with Windows updates some can break functional scripts/applications.

As written in the comments section of the question. The reason why the scripts stopped working is windows update (don't know the specific one as I don't have the access to the computer mentioned).

You could add it to the answer if you want.

tukan
  • 17,050
  • 1
  • 20
  • 48