excel - 在通过powershell完全刷新之前保持excel打开?
问题描述
我正在使用这个powershell脚本打开一个excel,运行一个宏来刷新所有,保存并关闭。这工作正常,但在完全刷新 excel 之前,excel 正在保存和关闭。有没有办法我可以添加一个等待语句,以便它可以等到工作簿完全刷新。
$objectExcel = new-object -c excel.application
$objectExcel.displayAlerts = $false # don't prompt the user
$objectExcel.visible = $True;
#$objectExcel.visible = $True;
$Classeur = $objectExcel.workbooks.open("\\gbrmiteufs01.eu.xerox.net\SWG01\XOG-BORG\EBIP\POS Data\POS
Data.xlsm", $null, $false)
$objectExcel.run("Workbook_RefreshAll")
$objectExcel.run("RemoveODBC") # another custom macro for removing data connecion
$Classeur.save()
$Classeur.close()
$objectExcel.quit()
解决方案
推荐阅读
- python - 全局变量不随 Python 和 MQTT 改变
- android - 如何将白色半透明颜色设置为状态栏
- vb.net - Windows vb.net中的.Binding复选框错误
- python - Ansible 消息:“未安装 winrm 或请求:无法导入名称证书”
- php - 如何替换 Symfony 中的帮助命令?
- javascript - 循环遍历 CSS 元素宽度
- python - 如何在循环中使用相同的套接字?
- pygame - 如何使用 keydown 事件类型?目前,当我按下箭头键时,Atom 中的光标指针正在移动
- eclipse - 为什么 Eclipse Git 在 2 个分支中同步文件时显示红旗而没有真正的区别?
- php - PHP/GD:如何处理 jpg 透明度?