Re: Problem Code Signing a VBA Macro in an Excel 2002/2003

From: Peter (peterguy)
Date: 11/18/04


Date: Thu, 18 Nov 2004 10:33:05 -0800

Did you try talking to your cert provider, Comodo? Perhaps you need to add "Microsoft Enhanced Cryptographic Provider v1.0" as a reference to the project? Shots in the twilight.

The following doesn't directly answer your question, but suggests a different way to achieve trustedness for your macros (which might be of no interest to you since you've already forked out the dough for a cert).
I know that Word defines certain folders as "trusted locations", and that if a macro is loaded from one of those locations, it is trusted implicitly, w/out having to be signed, as long as the "trust all installed add-ins and templates" checkbox is checked (IIRC, it's checked by default). Excel has a similar setup, doesn't seem to be quite as rich as Word's setup. I don't know how to display/set the trusted locations via a GUI, but the following properties can be accessed programmatically:

Application.NetworkTemplatesPath
Application.TemplatesPath
Application.StartupPath

As I understand it, if you put your macros in any of the those three folders, Excel should accept them as trusted and not complain about running them as long as the aforementioned checkbox is checked, unless security is set to "very high" (2003 only), then they would have to be signed _and_ put in those folders.
At least, that's how I understand it.

Anyone have more insight, please correct/expand on this.

A bit more info here:
http://office.microsoft.com/en-us/assistance/HA011189901033.aspx

hth,

-Peter

"Stephen Davies" <StephenDavies@discussions.microsoft.com> wrote in message news:35539BAE-72B5-47BE-98E9-A8FD22CC593E@microsoft.com...
> I have obtained a Digital Code Signing certificate from Comodo (InstantSSL)
> and installed it in my Certificate Store. It has a 1024 bit key using
> Microsoft Enhanced Cryptographic Provider v1.0.
>
> After opening my Excel spread*** I edit the macros (Alt-F11) click on the
> project and select Tools|Digital Signatures.
>
> From here Choose my certificate and click OK, this informs me that the VBA
> project is currently signed by my company (viewing the cert shows it was
> issued by Comodo).
>
> Close the VBA editor and save the work***. In Excel 2002 the spread***
> closes without question. In Excel 2003 I receive the message
>
> --------------------------------------------
> There were problems with the digital certificate. The VBA project could not
> be signed. The signature will be discarded.
> --------------------------------------------
>
> When I open either the 2002 or 2003 ***, edit the VBA project and view the
> digital certificate nothing is install and of course the spread***
> complains about the macros not being signed on medium & high security setting.
>
> Whats going wrong here, it all worked will with the TEST self signed
> certificate, I just now need to do the real thing.
>
> --
> Regards
> Stephen Davies