Not opening a Word Doc if Macros are Not On

  • Thread starter MichaelJohnson168
  • Start date
M

MichaelJohnson168

When a user opens a word file, "File.doc" for example. I would like to
find out if they have their Macros turned on. If they do not, then I
do not want for them to be able to open the document. Since the macros
are essential for the file to work properly.

Does anyone know if and how this can be done?


Thanks
 
J

Jonathan West

When a user opens a word file, "File.doc" for example. I would like to
find out if they have their Macros turned on. If they do not, then I
do not want for them to be able to open the document. Since the macros
are essential for the file to work properly.

Does anyone know if and how this can be done?


Sorry, it can't.


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

Graham Mayor

Jonathan is correct, however there is a ruse that you could try that would
work around the problem.
Add a new paragraph at the top of the document eg

This document contains macros essential for the document to be completed
correctly. Please enable macros (tools > options > security - set macro
security to Medium) then re-open the document and allow the macros to run.

Format the paragraph distinctively so it cannot be missed.

Add an autoopen macro to the document containing the following line
ActiveDocument.Paragraphs(1).Range.Delete

If the user has macro security preventing the running of the macros, the
text will be shown when the document is opened. If not the macro will delete
it.


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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