Macro Security Level !

B

Bo_T

HI !


I know it's not possible to check the security level with VBa when the
doc is open by a user.

....but I want the user changes this security level and so ...I would
like to avoid the user doing anything else in the opening doc
excepted:

- reading a message explaining the user must change the security level
to the "middle" level if an above level is checked
-checking the security level
-closing the doc without saving it


...or anything else to get similar results ...

....until the security level is middle or under ...and so the doc will
open normally at this time !

Any help to try writting this?


Thanks in advance!


Thierry Borgne
 
J

Jonathan West

Hi Bo,

The problem is that if the user is on High security, no VBA code in the
document will run at all. Therefore there is no way of prevnting the user
from doing anything they want to the document.

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

Ed

Bo:

You're going to have to rely on the user to close the document without
saving any changes. What I did was create a single large table cell with
the message that if the user can read this, they need to close the doc and
change their macro security settings. Then, in the document VBA, I have

Private Sub Document_Open()
Dim docThis As Document
Set docThis = ActiveDocument
' Collapse table cell with warning
docThis.Tables(1).Rows(1).SetHeight RowHeight:=0.5, _
HeightRule:=wdRowHeightExactly
' Call form to start other processes
StartUp.Show
DoEvents
' Undo collapse table
docThis.Undo 1
Application.Quit
End Sub

As you notice, I use a UserForm, and it interacts with other documents; this
initial doc is not really used except to begin the process. So this
approach may not work as well for you.

Ed
 
C

Charles Kenyon

What you could do is put your real document content into an AutoText entry.
Then replace the content with a message that tells the user how to reset
security level and urging them to do so and to then enable the macros upon
reopening the document.

Have an AutoNew macro that replaces the message with your actual content.
Have an AutoOpen macro that runs the AutoNew macro.

Then distribute the template with instructions to put it in the user
templates folder or the workgroup templates folder. (These instructions
could also be a part of your disappearing instructions if you want.)

This is not secure and is far from idiot-proof but it may go a long way in
the direction you are trying to travel.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
B

Bo_T

Thanks for your answers!

Finally I'm going to save the doc with "reading only" and with
messages in the body instead of form's text fields to explain it's not
possible to fill the form without checking security level !

And in the sub "document_open" I will test the protect level and if
read only I will check it to the "form" level!

Not so bad to solve the problem !


Thierry Borgne
 

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