I've tried a few ways I've seen on here to get this to work but with no success. Most say use .formula or escape characters. I was able to add normal data to cells but I can't add the formula. I know it works outside of Powershell.
Here's the line:
$WS.Cells.Item(6,4).formula = "='C:\Users\JG\Desktop\Reference\Financial\Test\[$MNE.xlsx]$MNE'!$O$28"
And the error:
Exception from HRESULT: 0x800A03EC At C:\Users\JG\Desktop\Reference\Test\Test2.ps1:47 char:1 + $WS.Cells.Item(6,4).formula = "='C:\Users\JG\Desktop\Reference\ ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [], COMException + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Any help is appreciated. Thanks.