“CreateObject”随机地抛出“系统关闭已被调度”错误 [英] CreateObject randomly throws "A system shutdown has already been scheduled" error

查看:779
本文介绍了“CreateObject”随机地抛出“系统关闭已被调度”错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的工作围绕着让我的同事们更加轻松。



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



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



下载该人员的权限,然后与服务器来回产生一个会话密钥,然后流行音乐互联网浏览器打开了他们从工作簿中的下拉菜单中选择的相关工具 - 这意味着他们的会话和工具就是纯粹基于浏览器的。



全部工作很棒,但随机,有时,当sub打开互联网浏览器触发一个非常奇怪的错误消息出现: -





点击Debug后,会显示以下功能,你可以看到自己的行以黄色突出显示。





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



请帮忙!感谢提前。

解决方案

有了这个看似无关和间歇性的错误,我通常会选择稍微延迟一点,错误和重试,或两者兼顾。



尝试以下操作(不要拖延重试):

 code>函数gogogo(sessKey)
错误GoTo ErrHandler
reportId = Sheet2.Range(A&(Sheet2.Range(B1)。Value + 1))。
Set objIE = CreateObject(InternetExplorer.Application)
URL =http:// localinternetdomainhere / OnlineTools /& reportId& / access /& sessKey
带objIE
.Visible = True
.navigate URL
结束
ThisWorkbook.Saved = True
ThisWorkbook.Close False
退出函数

ErrHandler:

如果Err.Number =& H800704A6然后'在这里放一个断点,以确保这是ACTUAL VBA错误号,而不是ActiveX。您可能需要检查Err.LastDllError属性
Resume
End If
Err.Raise Err.Number,Err.Source,Err.Description,err.HelpFile,err.HelpContext'Reraise错误否则

结束函数


I googled and SO'd, and nothing.

My job revolves around making my co-workers lives easier.

Currently, they are using very clunky spreadsheets designed 10+ years ago.

In the process of migrating their tools and reports to the local intranet using PHP, i have configured a spreadsheet that downloads that persons permissions based on their Application.Username

Then a little back and forth with the server to generate a session key, and then pop internet explorer opens up with the relevant tool they selected from a dropdown within the workbook - meaning their session and tools are then purely browser based.

All works great, however randomly, sometimes, when the sub to open the internet browser is triggered a very bizarre error message appears :-

Upon clicking Debug, the following function is shown, and you can see for yourself which line is highlighted in yellow.

I can confirm i do not have any tasks at all within my taskschedule. When i end this, and run it again, chances are it runs just fine.. it is just sometimes that this error pops up.

Please help! Thank in advance.

解决方案

With errors this seemingly-unrelated and intermittent, I usually opt for either a bit of delay, catching the error and retrying or both.

Try the following (retry without a delay):

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

这篇关于“CreateObject”随机地抛出“系统关闭已被调度”错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆