Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / July 2007

Tip: Looking for answers? Try searching our database.

VBA and Security Certificates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Roderick O'Regan - 18 Jul 2007 17:36 GMT
I don't know whether this is relevant here but would like to know if
someone has had experience of the following. Failing that, a pointer
to an appropriate newsgroup could be helpful:

I have signed macros with a security certificate and time stamped them
also. My client has now asked me if it is possible to trap the button
which says "Disable Macros" in the security dialog box  and prevents
the document from opening at all rather than opening with disable
macros.

In other word "Accept the macros for these templates or nothing will
open".

My initial feeling is that it cannot be done. But I'd like some
experienced views on this, if possible.

Roderick
Warrio - 20 Jul 2007 18:05 GMT
Hi Roderick,

everything is possible if you spend enough time on it...

but I didn't get what you really want to do...

-  Do you want to skip the message box asking to enable or disable the
macros inside your file?
  you must have been able to do it if you are using a trusted
certificate...

-  and which templates are talking about?

-  what would happen (in the desired version) when the client tries to open
your file?

PS: I'll go on wend soon, but I'll look for your answer on Monday!

>I don't know whether this is relevant here but would like to know if
> someone has had experience of the following. Failing that, a pointer
[quoted text clipped - 13 lines]
>
> Roderick
Roderick O'Regan - 23 Jul 2007 10:26 GMT
Hi Warrio.

Thanks for the reply.

As I mentioned, I have developed some templates with VBA modules
within each of them. They are **not** based on the Normal template

I have bought a security certificate from Thawte to allow me to secure
VBA code.

It all works perfectly except that my client has asked for an addition
whereby if one of their users runs the template and the dialog box
appears asking them whether they trust the template or not, then if
the user selects the "Diable Macros" button or the Close (X) button it
shuts the document down completely rather than opening it without the
macros.

In other words, my client wants to say to their users "If you don't
accept the macros you will not even get the document"

I suppose it is really trapping the user's reply before the macros are
run.

Does this help a little more, now?

Roderick

>Hi Roderick,
>
[quoted text clipped - 31 lines]
>>
>> Roderick
Warrio - 23 Jul 2007 13:01 GMT
Much clearer now!

First, if you have bought the certificate, it was to do not have this
message box asking whether to enable or disable the macros. It's purpose
that it certify that the code inside is safe and can be trusted.

So all the users who would use the document should open the document whitout
having to answer any question, unless you haven't set your certificate
correctly.

But now if your client wants to separate users that have clicked on yes from
those who have clicked on no, you can do nothing (you cannot run a code that
will disable the opening of the document and nothing else because the user
doesn't allow you to run any code!! logic).

so for that you must use a trick and you have three solutions:

1. is to create a document that will open the file that you are interest in.
   just write in the the Open Event of your Document
       Application.Documents.Open ""    'Your document full path
       ThisDocument.Close False            'Close the document

because this document has some code in it, it will ask the question :"Enable
or disable macros"....
if the user accepts, it will do what you want, if not, he will see only a
blank document (that you can set to ReadOnly to he cannot modify it)
that's a solution, a bit weird, but works..

2. the best solution is to everything by code!
in your document that must run without having MSWord asking to enable or
disable your code, because now you have a trusted certificate.
at the opening of the document, You will ask with a message box your client
question
if the user answers yes, you will do something, if not, you'll do something
else.

the advantage of this solution is that it allows you to run your code in any
case.

3. Set a password to your document like the company name so all the users
can remember it...

> Hi Warrio.
>
[quoted text clipped - 59 lines]
>>>
>>> Roderick
Roderick O'Regan - 25 Jul 2007 14:18 GMT
Thanks for the reply, Warrio.

Once I get my head around the three solutions I'll put them in a way
that my client will understand.

Knowing him he might decide it's not worth it and say to his users "If
you don't trust the source you'll get a blank document without any
functionality (the normal condition) but don't shout at me if nothing
works!"

Roderick

>Much clearer now!
>
[quoted text clipped - 101 lines]
>>>>
>>>> Roderick

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.