C# COM Office Automation - RPC_E_SYS_CALL_FAILED

自闭症网瘾萝莉.ら 提交于 2019-12-04 08:26:09

I don't know it is related to your problem, but all your COM calls must come from within the same thread your add-in was created on. If you created new threads you must take special care. Details are described in these two articles:

are you making the call from a thread with its ApartmentState set? if not, that might be the culprit - COM interop is pretty finicky about that sort of thing

What are the security settings of the client? It is quite possible that the security settings of the client (either Windows/OS settings or PowerPoint/App settings) won't allow your plug-in to communicate via RPC.

This can very easily happen if you make any calls to the Powerpoint object model from a background thread. One plausible scenario is having a timer that periodically checks some sort of status value. If, when the timer fires, Powerpoint is busy (for example a dialog box is open) the call will fail.

This Microsoft article gives an overview of threading support in Office: http://msdn.microsoft.com/en-us/library/8sesy69e.aspx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!