How to programmatically sign code in a Word document

NOTE. This is not a duplicate, because I ask for code signing, not in the document.

On a regular basis, we need to renew the certificates used to sign the code in the entire stack of Microsoft Word documents. This may be due to updating the VBA code itself.

To be clear, I want to sign code / macros in a document so that they can run. I intend not to sign the document. See http://support.microsoft.com/kb/920627 , for a difference.

We created a utility using C # that allows us to update VBA code, links, and many other aspects of these templates, but we never found a good way to renew a certificate.

Our code has access to the following namespaces.

using Microsoft.Office.Interop.Word
using Microsoft.Vbe.Interop;
using Microsoft.Office.Core;

Our current solution using SendKeys is fragile and simply unacceptable.

+4
source share

Source: https://habr.com/ru/post/1540584/


All Articles