0
它是在Excel 2003中VBAPowershell:如何設置excel應用程序的計算模式?
Application.Calculation = xlCalculationManual
我想實現在PowerShell中的相同。這是我做過什麼:
$excel = New-Object -com Excel.Application
$xlCalculationManual = -4135
$excel.Calculation = $xlCalculationManual
值-4135從那裏得到:http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.constants%28v=office.14%29.aspx
它拋出一個異常:
Exception setting "Calculation": "Unable to set the Calculation property of the Application class"
At C:\Documents and Settings\AUser\Desktop\ppp2eikon.ps1:11 char:8
+ $excel. <<<< Calculation = $xlCalculationManual
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
什麼是設置此屬性的正確方法?