通过代码禁用COM-Addin

问题描述 投票:0回答:1

在我们公司内部,我们有2个在Excel中不相处的插件。其中一个插件来自SAP(例如无法修改)。另一个是使用Add In Express开发的本地人

问题局限于Excel。当我们尝试从受保护的视图中提取文档时。使用以下代码

ExcelApp.ActiveProtectedViewWindow.Edit()

当我们执行该行代码时,另一个(SAP)插件开始抛出访问冲突。

1st error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt
2nd error: Exception from HResult 0x800A03EC

现在我正在努力解决冲突。但我被卡住了。我找不到另一种方法来成功地将文档从受保护的视图中提起

暂时禁用SAP addIn似乎也不起作用。因为Application.Addins不包含COM-Addins。并且Application.CommAddins抛出以下错误:

       ExcelApp.COMAddIns   The embedded interop type 'COMAddIns' does not contain a 
       definition for'Microsoft.Office.Interop.Excel._Application' since it was not used 
       in the compiled assembly. Consider casting to object or changing the 'Embed Interop Types' 
       property to true.    

然而Embed Interop Types被设置为真。

所以任何想法?

注意禁用qazxsw poi不是一个选项。因为它是在公司层面上决定的:-(

.net excel vb.net excel-interop
1个回答
0
投票

我设法解决了这个问题。感谢Protected view使用以下代码我可以使用vb.code禁用/启用某些COM-Addins

在这种情况下,Charles Williams是AddIn,它会导致我们所有的问题。

SapExcelAddIn
© www.soinside.com 2019 - 2024. All rights reserved.