Is there a way to programmatically add a digital signature to a VBA Macro in a word document?

爱⌒轻易说出口 提交于 2019-12-20 02:42:17

问题


Is there a way to programmatically add a digital signature to a VBA Macro in a word document using C# or VB.Net?

There are some similar questions asked already; however, none that I could find answer my question: How to programmatically remove the digital signature from VBA macros in Excel? Digital Signature for Excel Macro


回答1:


Unfortunately, there isn't an automation API for this in the VBA environment. I got it working 100% unattended (so I could use it in automated builds) by P/Invoking Win32 APIs to grab the right window handles and simulate the keyboard shortcuts to those windows, highlight the right cert, etc. Even had it working to detect and capture compilation errors (grab the error dialog window and dig out the label control text). It took me a few days of hacking to get it working reliably, but it is possible, and really not even that hard.

I'd be happy to post it, but my previous employer owns the code. :(



来源:https://stackoverflow.com/questions/1480050/is-there-a-way-to-programmatically-add-a-digital-signature-to-a-vba-macro-in-a-w

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