Is there any way to programmatically remove the digital signature from the VBA macros of an Excel sheet?
i.e. code that is equivalent to entering the VBA editor, going to Tools menu -> Digital Signature and clicking Remove.
Is there any way to programmatically remove the digital signature from the VBA macros of an Excel sheet?
i.e. code that is equivalent to entering the VBA editor, going to Tools menu -> Digital Signature and clicking Remove.
Interesting question. It's deliberately not part of the Excel object model for security reasons.
It is possible to remove the certificate from the certificate store. This requires Win32 api calls (which can be made from VB6 or VBA but I'm not sure of the exact effect on your project once you do this... It will definately invalidate the certificate, but I don't know if it will remove it. Also you may not wish to remove the certificate from the store (since you could be using it for something else).
To view the certificate store, type, certmgr.msc at the Run prompt.
anyway a link on how to remove a certificate programmatically.
KB article showing how to remove a trusted root certificate from the store.
Requirements:
1. You'll need to download the Windows SDK for the appropriate platform to get the capicom dll's, + regsvr32 them
2. You'll need to extract the public key from the certifcate you want to remove.
3. Test with a uninmportant workbook first, I have no idea whether this method will (apart from invalidating the certificate) also cause corruption in the workbook. Hopefully someone has a better suggestion than this.