CreateObject随机抛出“系统关机已经安排”错误

我Googlesearch了,没有任何东西。

我的工作围绕让我的同事生活更轻松。

目前,他们正在使用十多年前devise的非常笨重的电子表格。

在使用PHP将他们的工具和报告迁移到本地Intranet的过程中,我已经configuration了一个电子表格,根据他们的Application.Username

然后在服务器之间来回地生成一个会话密钥,然后popup Internet Explorer打开它们从工作簿中的下拉列表中select的相关工具 – 这意味着他们的会话和工具纯粹是基于浏览器的。

所有的作品很好,但是随机的,有时,当子打开互联网浏览器触发一个非常奇怪的错误消息出现: –

点击Debug后,会显示以下function,您可以自己查看哪一行以黄色突出显示。

我可以确认在我的任务计划内没有任何任务。 当我结束这个,并再次运行它,机会是运行得很好.. 有时只是这个错误popup。

请帮忙! 预先感谢。

由于这个看似不相关和间歇性的错误,我通常select延迟一点,捕捉错误并重试,或者两者兼而有之。

尝试以下(重试没有延迟):

Function gogogo(sessKey) On Error GoTo ErrHandler reportId = Sheet2.Range("A" & (Sheet2.Range("B1").Value + 1)).Value Set objIE = CreateObject("InternetExplorer.Application") URL = "http://localinternetdomainhere/OnlineTools/" & reportId & "/access/" & sessKey With objIE .Visible = True .navigate URL End With ThisWorkbook.Saved = True ThisWorkbook.Close False Exit Function ErrHandler: If Err.Number = &H800704A6 Then 'Put a breakpoint here to make sure this is the ACTUAL VBA error number and not the ActiveX one. You might need to check against the Err.LastDllError property Resume End If Err.Raise Err.Number, Err.Source, Err.Description,err.HelpFile, err.HelpContext 'Reraise the error otherwise End Function