Powershell hard crash on PIA event trigger

0

Seeing a weird problem with powershell, here's the code:

[Reflection.Assembly]::LoadWithPartialname("Microsoft.Office.Interop.PowerPoint")
$ppt = New-Object Microsoft.Office.Interop.PowerPoint.ApplicationClass
Register-ObjectEvent -InputObject $ppt -EventName "PresentationBeforeSave" -SourceIdentifier "LBPPTBeforeSave" -Action { Write-Host "here" }

I'm hooking into PresentationBeforeSave in PowerPoint. This registers fine, but when I hit save in Powerpoint ISE completely crashes. In event viewer I see bad stuff, exit code 80131506 and 0xc0000005.

I can hook SlideSelectionChanged just fine though. So I'm wondering if this has something to do with the Cancel out variable that PresentationBeforeSave exposes? Any advice would be appreciated.

powershell
com
pia
asked on Stack Overflow Dec 18, 2020 by grivescorbett

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0