HRESULT的异常:0x800401E3(MK_E_UNAVAILABLE)解决方法 [英] Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE) Workarounds

查看:551
本文介绍了HRESULT的异常:0x800401E3(MK_E_UNAVAILABLE)解决方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过以下通话

Marshal.GetActiveObject("Excel.Application")

我得到一个

操作不可用(HRESULT异常:0x800401E3(MK_E_UNAVAILABLE))

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

我相信,当我的应用程序和excel之间的用户权限不匹配时,会导致此错误.

I believe that this error is caused when the user permissions between my application and excel do not match.

我想知道是否有一种解决方法,无论如何打开excel都可以访问打开的excel应用程序,我可以以管理员身份打开要访问excell的程序.

I want to know if there is a workaround as to how I can access the opened excel application regardless of how excel is opened, I can open the program that I want to access excell from as an administrator.

我还想知道如何知道打开了哪些权限进程?我一直在使用ProcessExplorer查看UserProfile(在两个应用程序中都是相同的)和Owner(也是相同的BUILTIN \ Administrators)

Also I would like to know how I can tell what permissions processes were opened with? I have been using ProcessExplorer to look at the UserProfile (which was the same in both applications), and Owner (which was also the same BUILTIN\Administrators)

背景 我有一个通过调用NUnit-console-x86运行不同测试的程序.被测试的应用程序将打开一个excel表格,这是我要从中读取数据的表格.而且,当我以管理员身份运行程序时,是否出现这些错误,我也尝试添加Process.StartInfo.Verb ="runas";到启动NUnit的程序,但是我仍然遇到这些错误

Background I have a program that run different tests by calling NUnit-console-x86. The application that is being tested opens up an excel form, this is the form that I want to read the data from. And when i run my program as administrator, or not I get these errors, I have also tried adding in Process.StartInfo.Verb = "runas"; to my program that starts up NUnit but I still get these errors

尽管我不想在每台计算机上都安装Visual Studio,但安装Visual Studio似乎可以解决该问题. 任何人都可以向我解释一下吗?

It appears installing visual studio fixes the problem although I do not want to have to install visual studio on every computer. Can anyone explain any of this to me?

推荐答案

查看 Microsoft支持信息,当Excel(或一般的Office)未处于活动状态或在运行的对象表"中运行时,似乎会生成0x800401e3.调用此文件之前,您必须打开excel的副本.您可能尚未在代码中打开excel,或者尚未完全注册.这可能是问题吗?

Looking at Microsoft Support Information, 0x800401e3 seems to be generated when excel (or office in general) isn't active or running in the Running Object Table. You have to have a copy of excel opened before you call this. Its either you haven't opened excel in code yet, or its not fully registered yet. Could this be the problem?

这篇关于HRESULT的异常:0x800401E3(MK_E_UNAVAILABLE)解决方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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