How to secure Word VBA / macro?

Z

ZLA

I need to create a word macro / VBA code that will open a separate Word
document, print it and

then delete the file printed. I need to make this reasonably secure. I have
some experience with

Excel VBA but not in Word.

1. Can / how do I create a macro / VBA that can only be executed by the user
but not viewed or

edited?
2. Can a user interrupt a macro / VBA (for example Ctrl-Break) while it is
running? Is there any

way to prevent that? If not, is there anyway to at least run some cleanup
code if they do?
3. How secure are password protected Word documents? Does the password
automatically encrypt the

contents?
4. Do Word macros created from a Windows computer work when opened from a Mac?

Thanks in advance.
 
J

Jonathan West

ZLA said:
I need to create a word macro / VBA code that will open a separate Word
document, print it and
then delete the file printed. I need to make this reasonably secure. I
have
some experience with

Excel VBA but not in Word.

1. Can / how do I create a macro / VBA that can only be executed by the
user
but not viewed or
edited?

In the VBA editor, go to "Templateproject Properties". On the dialog that
appears, click the Protection tab. Check the "Lock project for viewing"
checkbox and type in a suitable password into the Password and Confirm
password boxes.

Beware that there are password-cracking tools out there that will make short
work of any such password, (in Excel as well as Word) so this does not offer
security against someone who is sufficiently knowledgeable and determined.
2. Can a user interrupt a macro / VBA (for example Ctrl-Break) while it is
running?
Yes.

Is there any
way to prevent that?

Yes, set the EnableCancelKey property to an appropriate value
If not, is there anyway to at least run some cleanup
code if they do?
3. How secure are password protected Word documents? Does the password
automatically encrypt the
contents?

Do you mean password-protected VBA projects or password-potected documents.
I believe password-protected documents are fairly secure, though there is
nothing to prevent a user with the password from copying the content into an
unprotected document and editing it there. VBA projects should not be
regarded as secure from determined hackers.
4. Do Word macros created from a Windows computer work when opened from a
Mac?

Sometimes. You need to thoroughly test this. In addition, if different
Windows users will be using different versions of Word, you need to test on
*all* the versions of Word you will be supporting. I'd suggest you use the
oldest version for development and test on the newer ones..


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