Excel ChangeLink 停止打开目标电子表格
Excel ChangeLink to stop opening the destination spreadsheet
我在 .NET 应用程序中使用 Excel Interop 来更新损坏的 excel links(links 到其他电子表格)。我需要运行在后台处理大量文件。
objWorkbook.ChangeLink(currentLinkName, newLinkName)
它适用于大多数情况。但是如果 newLinkName 是受密码保护的电子表格,Excel 将弹出 window 要求输入密码。这告诉我 Excel 正在尝试打开它。我可以点击取消,并且 link 在源文件中成功更新,但是,它破坏了我的后台处理。
有什么办法可以告诉Excel"do not try to open the spreadsheet that I'm linking to"?
非常感谢!
我从来没有找到答案,只有一个解决方法。我最终将 AutoIt 与脚本一起使用,该脚本会一遍又一遍地取消弹出的任何密码对话框。
脚本:
Do
WinWait("Password")
WinActivate("Password")
WinWaitActive("Password", "", 5)
Send("{TAB}{ENTER}")
Sleep(1000)
Until 1 = 2
希望对大家有所帮助。
我在 .NET 应用程序中使用 Excel Interop 来更新损坏的 excel links(links 到其他电子表格)。我需要运行在后台处理大量文件。
objWorkbook.ChangeLink(currentLinkName, newLinkName)
它适用于大多数情况。但是如果 newLinkName 是受密码保护的电子表格,Excel 将弹出 window 要求输入密码。这告诉我 Excel 正在尝试打开它。我可以点击取消,并且 link 在源文件中成功更新,但是,它破坏了我的后台处理。
有什么办法可以告诉Excel"do not try to open the spreadsheet that I'm linking to"?
非常感谢!
我从来没有找到答案,只有一个解决方法。我最终将 AutoIt 与脚本一起使用,该脚本会一遍又一遍地取消弹出的任何密码对话框。
脚本:
Do
WinWait("Password")
WinActivate("Password")
WinWaitActive("Password", "", 5)
Send("{TAB}{ENTER}")
Sleep(1000)
Until 1 = 2
希望对大家有所帮助。