I am runnning an excel file that populates with data that was already input, but I want to be able to make the excel file available to be manually edited if I need to. Every time I try, it throws an exception.
It only throws the exception if I have actually edited something on the excel document. If I leave it alone, it doesn't have any issues. Does anybody know why it's doing this?
This is the part of the script where it fails:
if($Additional_Info -eq 2){
$xl.visible = $true
Write-Host 'hit enter to continue'
Read-Host
$xl.visible = $false
$ws1.activate()
}
$ws1.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, "C:\file\excel\information")
The error that pops up is:
Call was rejected by callee. (Exception from HRESULT: 0x80010001
(RPC_E_CALL_REJECTED)) At line:45 char:1 + $ws1.activate() + ~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
Call was rejected by callee. (Exception from HRESULT: 0x80010001
(RPC_E_CALL_REJECTED)) At line:49 char:1 +
$ws1.ExportAsFixedFormat($xlFixedFormat::xlTypePDF, "C:\Solar\PDFs\Li ... +
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (:) [], COMException
+ FullyQualifiedErrorId : System.Runtime.InteropServices.COMException
User contributions licensed under CC BY-SA 3.0