我嘗試在PowerPoint 2007中使用PowerShell 2.0腳本中的ExportAsFixedFormat
。只有前兩個參數是必需的,但這是行不通的。Powershell中的PowerPoint ExportAsFixedFormat
我總是得到:
異常調用 「ExportAsFixedFormat」 與 「2」 參數(S): 「類型不匹配(從HRESULT 異常:0x80020005(DISP_E_TYPEMISMATCH))」
我讀過所有參數都必須指定它的功能,但這也不起作用。順便說一句,同樣的方法適用於我在Word 2007和Excel 2007
那麼,什麼是錯的:
Add-type -AssemblyName Office
Add-type -AssemblyName Microsoft.Office.Interop.PowerPoint
$p = new-object -comobject powerpoint.application
$p.visible = 1
$document = $p.presentations.open('somefile.ppt')
$document.ExportAsFixedFormat($Path,
[Microsoft.Office.Interop.PowerPoint.PpFixedFormatType]::ppFixedFormatTypePDF,
[Microsoft.Office.Interop.PowerPoint.PpFixedFormatIntent]::ppFixedFormatIntentScreen,
[Microsoft.Office.Core.MsoTriState]::msoFalse,
[Microsoft.Office.Interop.PowerPoint.PpPrintHandoutOrder]::ppPrintHandoutVerticalFirst,
[Microsoft.Office.Interop.PowerPoint.PpPrintOutputType]::ppPrintOutputSlides,
[Microsoft.Office.Core.MsoTriState]::msoFalse,
$null,
[Microsoft.Office.Interop.PowerPoint.PpPrintRangeType]::ppPrintAll,
[System.Reflection.Missing]::Value,
$true,
$true,
$true,
$true,
$false,
[System.Reflection.Missing]::Value)
感謝答覆。不幸的是,沒有成功。 – 2010-11-04 16:26:40