programmatically signa vba project

H

Herve cadieu

Dear all,
i would like to know if there is a mean to sign programmatically some vba
macros embeded within a document so that the recipient will be prompted to
trust the project and allow the activation of the code even if the security
is set to High in his host application.

In fact I produce documents with a template and I embed some routines by
code to this document to offer extended functions to check digital signature
status of the document.
To achieve that I need to embed some routines in the document itself but
when opening on another computer the macros are disabled by default.
The solution should be to programmatically sign the VBA project before
applying the digital signature to the document itself so that both macros and
document are signed.
Anyone has an idea if it is possible ? I have cruised ver the VBIDE objects
but I cannot figure out how it could be done by code ? (if possible ?)
Thank you for your inputs
Best regards
 
J

Jonathan West

As far as I'm aware, there is no means to use code to digitally sign a VBA
project.

What you can do (provided you have the appropriate digital signature
available) is add code to an existing signed project, either by using the
VBE object or the OrganizerCopy method.

The way you could handle this in your application would be to open an
existing blank document which you have signed, add the necessary code and
content to it, then save it under a new name. All that can be done
programmatically.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
H

Herve cadieu

Dear Jonathan ,
Thank you much for your input.
Can you tell me more about how to load an empty project holding signed
macros to establish the new document with embeded smartness?
Could you provide me a skeleton of code snippet ?

You can see about my authenticated Grapho-Lock documents on the web by
searching grapho-lock with google.
I make the pond over the bond between dynamically verified handwritten
signature and digital signature...
thank you in advance
(e-mail address removed) for additionnal discussions
 
J

Jonathan West

Hi Herve,

You might need to have the document pre-loaded with a dummy module that
contains nothing but a comment or two, just so there is a VBA project
present for you to sign.

You can then use the OrganizerCopy method to copy modules from other
templates. You can look up the OrganizerCopy method in the VBA Help.

One thing you must be aware of - both the source and destination files must
not have no password protection on their VBA projects. If either file has a
VBA project password, OrganizerCopy (and any other method of transferring
code) will fail.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 
H

Herve cadieu

Thank you much Jonathan
Ok I undestand now why my code was not embeded with ! it is beacuse I was
setting a password in the vba project...
Ok then
and what about with a com add-in ?
Should it be possible from a com add-in as far as you know ?
What if I was trying to derive from the main object application ?

sincerely
herve
 
J

Jonathan West

I can't think how a COM add-in could possibly be of any help to you in this
case. You can't import or export VBA modules from a COM add-in.

I have to say that overall I think this whole approach is very problematical
and I doubt you are going to get it to work. How about you describe in
simple terms what you are trying to achieve. We might be able to think of a
completely different approach.

--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
Keep your VBA code safe, sign the ClassicVB petition www.classicvb.org
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top