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
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