Is there a way to programmatically add a digital signature to a VBA macro in a text document?

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

There are already several similar questions; however, none of what I could find answered my question: How to programmatically remove a digital signature from VBA macros in Excel? Digital Signature for Excel Macro

+1
source share
1 answer

Unfortunately, for the VBA environment, there is no automation API for this. I got it 100% unattended (so that I could use it in automatic assemblies) using the P / Invoking Win32 API to capture the correct window handles and simulate keyboard shortcuts in these windows, highlight the correct certificate, etc. Even if it worked with detecting and recording compilation errors (grab the error dialog box and dig up the label control text). It took me a few days of hacking to get it to work reliably, but it is possible, and actually not even that difficult.

I would be happy to publish it, but my previous employer owns the code .: (

+2
source

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


All Articles