我看到了excel.com对象的一个属性(或方法(,该属性与.visible属性组合显示电子表格的更改。但就我的一生而言,我现在找不到它。请帮助
您的意思是将Excel设置为自动计算吗?
如果是这样,可以这样做:
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $true
# open an Excel file because you can only set the '.Calculation' property when at least one workbook is opened
$workbook = $excel.Workbooks.Open('X:SomeFile.xlsx')
# set Autocalculation, see below
$excel.Calculation = -4105 # turn on AutoCalculate
这些是来自XlCalculation枚举的.Calculation
的可接受值
名称 | 值 | 描述 |
---|---|---|
xlCalculationAutomatic | -4105 | Excel控制重新计算|
xlCalculationManual | ||
xlCalculation半自动 | 2 | Excel控制重新计算,但忽略表中的更改 |