有没有一种方法可以以编程方式将数字签名添加到Word文档中的VBA宏中? [英] Is there a way to programmatically add a digital signature to a VBA Macro in a word document?

查看:82
本文介绍了有没有一种方法可以以编程方式将数字签名添加到Word文档中的VBA宏中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用C#或VB.Net以编程方式向Word文档中的VBA宏添加数字签名?

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

已经有一些类似的问题;但是,找不到我能回答我的问题的东西: 如何以编程方式从Excel中的VBA宏? 用于Excel宏的数字签名

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

推荐答案

不幸的是,VBA环境中没有针对此的自动化API.通过P/调用Win32 API,我可以使其100%无人值守(因此可以在自动构建中使用它),以获取正确的窗口句柄并模拟这些窗口的键盘快捷键,突出显示正确的证书,等等.检测并捕获编译错误(抓住错误对话框窗口并挖出标签控件文本).我花了几天的时间才能使它可靠地工作,但是确实有可能,甚至没有那么难.

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. :(

这篇关于有没有一种方法可以以编程方式将数字签名添加到Word文档中的VBA宏中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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