VBScript:等待Excel MsgBox,单击确定

我写了一个VBScript,可以自动处理Excel工作簿。

对于这些工作簿中的某些工作簿,MsgBox在打开时会被触发。 这个消息框正在中断自动化。

有没有一种方法来听取这个MsgBox在VBScript和“点击”确定,当它popup?

尝试使用这个包装:

Application.DisplayAlerts = False Application.Workbooks.Open ([your code]) Application.DisplayAlerts = True 

这将打开任何警告,例如兼容性问题等。

更新:

如果MsgBox是从工作簿代码生成的,请尝试使用以下命令:

 Application.AutomationSecurity = msoAutomationSecurityForceDisable 

如果使用延迟绑定,这将工作:

 Application.AutomationSecurity = 3 

阅读更多: http : //support.microsoft.com/kb/886633