# VBForums CodeBank > CodeBank - Visual Basic 6 and earlier >  VBA - Create a Digital Signature - Trusted Certificate

## RobDog888

Creating a trusted digital signature for your vba projects will 
allow you to set your macro security to very high - only macros 
installed in trusted locations will be allowed to run. All other 
signed and unsigned macros are disabled. 

This is the most secure level for macros. 

*Program Location:*
For Office 2003:
?:\Program Files\Microsoft Office\OFFICE11\SELFCERT.EXE

For Office XP:
?:\Program Files\Microsoft Office\OFFICE10\SELFCERT.EXE

etc.

If you do not have the SELFCERT.EXE program you can find it on 
your office CD or you can run setup again and install the Office 
Tools.

*Create the Digital Signature*
Run the program and follow the simple step. It will create the 
Digital Signature or "Certificate" for your vba projects.

Then in the VBA editor click Tools > Digital Signature... and click 
Choose button and select the certificate you just created.

This will attach the signature to the project.

You can also set the security on Excel to High - only signed macros 
from trusted sources will be run. 

So only your macros will run.


*To make you Digital Signature Certificate "Trusted"...*

*Export the Digital Signature*
After you create your D.S. view it like when you assign the D.S. to 
your VBA project - Tools > Digital Signature > Choose... > Select 
your certificate > View Certificate > Details Tab > Copy to file... 
Then you will see the Certificate Export wizard. Click Next > Next 
> Next > Browse to where you want to save it to (*.cer) > Next > 
Finish.

*Import the Certificate*
Browse to where you exported the certificate to and double click 
it and wait for it to display the certificate. Then click Install 
Certificate... > Next > Select "Place certificate in the following 
store." and browse to "Trusted Root Certification Authorities" > 
Next > Finish > Yes. Then your done.

Then check your VBA project's Digital Signature and it should 
show that it is now "Trusted". If not, remove the Digital Signature 
and then re-attach it to your VBA project again. You wil no longer 
see the little red circle x before the certificate name.

Enjoy  :Big Grin:

----------


## la_unt

Hi,

I'm new here....

Thank you! I'm looking for this also...

BTW, I notice a problem if user using Office Word 2003 with "very high" security level setting... the user will not be able to accept any signed macro...

Is there a way to detect the security level setting, and prompt the user to CHANGE the security level setting instead? If it is possible, would you please to give me a hand on this?


Thank you!
Arnold
 :wave:

----------


## RobDog888

The Digital Signatures are only valid up to the High security level.  :Wink:

----------


## Kohj

Hi RobDog,

Thanks to share a great info, i am a newbie for VB and VBA. Currently starting to learn about create program with VB and VBA. I am intersted with Digital signature which is allow user to enable macro that programmer created.

I already tried your advice but still have question about this.
1. Could some one hack the digital signature??
2. how to make automatitation for digital signature with my program in VBA excel or with VB
3. how to distribute this digital signature to other computer so they can able my program eventough the level security is high

thank you for your reply
i really appreciate your kind to answer this 

thanks again

----------


## RobDog888

Welcome to the Forums.

1. Anything is always possible.
2. What do you mean make automation for digital signature?
2. Cant, digital signatures are generated off of the systems hardware specs and other specs to make it only valid for that workstation.

----------


## Kohj

> Welcome to the Forums.
> 
> 1. Anything is always possible.
> 2. What do you mean make automation for digital signature?
> 3. Cant, digital signatures are generated off of the systems hardware specs and other specs to make it only valid for that workstation.


Thanks for your answer...

Question on nbr 2, in case if digital signature could distribute to other computer than macro will an automate to install it to client compt directly if client open the excel containing that macro.

its just my idea   :Big Grin:

----------


## RobDog888

Oh I see. One other option is to purchase a certificate from a public authority. They are not cheap but if you have a commercial product to distribute then its worth it.

----------


## Kohj

> Oh I see. One other option is to purchase a certificate from a public authority. They are not cheap but if you have a commercial product to distribute then its worth it.


Yeah, i already search those program.... but unfortunately my program is so simple and it will become not worthy to buy certificate soft....   :LOL:  

but anyway thanks again for your advice....   :wave:

----------


## zarora

I have a Excel file which has the Ditigital Signature >> Created by Selfcert.exe

I have to distribute this file to locations where pelope wont be knowing the Excel Macro concept also. is there a way where the Certificate automatically gets installed.
It works fine for office 97/2000 but my macros are disabled by default in office 2007

Please help

----------

