当Outlook在其他帐户下运行时,Outlook.CreateObject在Outlook.Application上失败 [英] CreateObject on Outlook.Application fails on Outlook 2010 when Outlook is running under a different account

查看:500
本文介绍了当Outlook在其他帐户下运行时,Outlook.CreateObject在Outlook.Application上失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的问题已在在Windows 7中获取/创建Outlook应用程序,但是我很难确定问题的根源,因为目前我正维护着一个旧的VB6应用程序,并且报告了VB6所报告的错误那篇文章没有提到应用程序。此外,我正在寻找更好的解决方案。

The problem I'm running into is already described at Getting/Creating an Outlook Application in Windows 7 but I had a very hard time identifying the source of the problem because I happen to be maintaining an old VB6 application at the moment, and the errors that are reported from VB6 applications are not mentioned in that article. Furthermore, I'm looking for better solutions.

问题是 CreateObject( Outlook.Application) GetObject(, Outlook.Application)失败,错误429-ActiveX组件无法创建对象,尤其是在Windows 7上。问题的根源是例如,如果Outlook已经以普通用户帐户运行并且应用程序正在以管理员身份运行(对于Windows 7上运行的旧32位应用程序来说并非闻所未闻)想要访问Outlook,则对Outlook COM接口的请求将挂起30秒,然后失败。似乎与以下事实有关:请求的Outlook实例和已经运行的Outlook实例正在使用不同的用户帐户或特权。

The problem is that CreateObject("Outlook.Application") and GetObject(,"Outlook.Application") are failing with Error 429 - ActiveX component can't create object, particularly on Windows 7. The source of the problem turns out to be that if Outlook is already running under a normal user account and an application is running as an administrator (not unheard of for old 32-bit applications running on Windows 7) wants to access Outlook, the request for an Outlook COM interface hangs for 30 seconds and then fails. It seems to be related to the fact that the requested instance of Outlook and the already-running instance of Outlook are using different user accounts or privileges.

这很好,首先,如果可以报告一个更好的错误,并且可以更快地报告它。通常,应用程序在报告错误之前会挂起30秒。所以第一个问题是,有没有办法在不等待30秒的情况下检测到这种情况?

It would be nice, first of all, if a better error could be reported, and if it could be reported more quickly. Usually the application hangs for 30 seconds before reporting the error. So the first question is, is there any way to detect this condition without waiting 30 seconds?

下一步,有没有办法解决这个错误,所以我们不当我们要访问Outlook API时,是否必须担心Outlook可能已经在不同的凭据下运行?一种想法是关闭UAC,以使旧的32位应用程序不太可能需要以管理员身份运行。有更好的解决方案吗?

Next, is there any way to work around this error so we don't have to care that Outlook might already be running under different credentials when we want to access the Outlook API? One thought is turning off UAC so that the old 32-bit application is less likely to need to be running as administrator. Is there a better solution?

推荐答案

我认为您已经解决了这个问题,但是以防万一,我也遇到了同样的问题对我来说,解决方案是使用API​​终止procces outlook.exe,然后执行 CreateObject

I assume you 've alredy resolved this, but just in case, i had the same proble and the solution for me was to terminate the procces outlook.exe with an API and then do "CreateObject"

您可以执行下一步:
如果err.number = 429,则
Terminateprocces( outlook.exe)'您可以在互联网上找到功能代码
继续
结尾,如果

这篇关于当Outlook在其他帐户下运行时,Outlook.CreateObject在Outlook.Application上失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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