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 / April 2005

Tip: Looking for answers? Try searching our database.

Macro Security Level !

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bo_T - 12 Apr 2005 11:54 GMT
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
Jonathan West - 12 Apr 2005 13:05 GMT
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.

Signature

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

> HI !
>
[quoted text clipped - 20 lines]
>
> Thierry Borgne
Ed - 12 Apr 2005 14:02 GMT
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

> Hi Bo,
>
[quoted text clipped - 26 lines]
> >
> > Thierry Borgne
Charles Kenyon - 12 Apr 2005 14:10 GMT
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.
Signature

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.

> HI !
>
[quoted text clipped - 20 lines]
>
> Thierry Borgne
Bo_T - 13 Apr 2005 12:13 GMT
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
 
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.