Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting Course Notes. (Word2000+)

    Chris,

    You'd have to protect the document for forms after decrypting it, not before, for the decrypt routine will fail in a protected document.

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    > for the decrypt routine will fail in a protected document.
    True.
    Also I've discovered a tiny bug in my use of the encrypt function; nothing major.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting Course Notes. (Word2000+)

    It doesn't work for me: "Compile error in hidden module ThisDocument".
    The VBA project has a missing reference to the template Train.dot, and presumably the function named crypt is stored in this template; it's not in the document.

  4. #4
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    My apologies. I'd put (I thought) the crypt function in the ThisDocument module.
    But fer sure I'd neglected to disable the reference and, for that matter, detach the template.
    If you have the time try this one. Passwords are still "password"
    Attached Files Attached Files

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Here is an improved version. But see <post#=702,252>post 702,252</post#>
    Password protected with temporary passwords "password"
    If I've done it right, you can read and print but not save or copy.
    You can import the doc into a fresh doc, but you'll get gibberish.
    Tomorrow I should generate a random password and store it as a document variable for use in the decryption routine.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Reduce the ability to print multiple copies.
    <pre>Private Sub myApplication_DocumentBeforePrint(ByVal Doc As Document, Cancel As Boolean)
    Doc.PrintOut Copies:=1, Background:=True, PrintToFile:=False, Item:=wdPrintDocumentContent
    Cancel = True
    End Sub</pre>


  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting Course Notes. (Word2000+)

    It works well now.

    One small note: I'd add

    Application.ScreenUpdating = False

    near the beginning of DecryptDocument and EncryptDocument, and

    Application.ScreenUpdating = True

    near the end.

  8. #8
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    >It works well now.
    Thanks
    >One small note: I'd add
    and Thanks.

  9. #9
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    <img src=/S/confused3.gif border=0 alt=confused3 width=45 height=45> Thank you this is very useful macro set.

    And how do I best apply the random variable concept code which I dumped at bottom of This Document and tossed in the Application Screen .... around decrypt encrypt. I also added go to beginning of document as it all happens on open.

    Help please!
    I copied the code in Editor to new document and encrypted one line of text and I receive an error still using "password" . I am using 2007 with 97-2003 compatible save.

    Am I missing a reference to something?

    Many thanks.
    Attached Files Attached Files

  10. #10
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting Course Notes. (Word2000+)

    Welcome to Woody's Lounge!

    The document has already been protected, but that prevents the encrypt/decrypt routine from being run.
    You should copy the code into an unprotected document, then run TESTEncryptDocument and save the document.
    The document will automatically be decrypted and protected next time it is opened.

    BTW the lines

    Selection.HomeKey Unit:=wdStory
    Application.ScreenUpdating = True

    should be the last lines above End Function in both functions. As it is now, they will be executed for each paragraph in the document.

  11. #11
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Jen, welcome to Woody's Lounge. You're welcome to the macros, but wait a day or two.
    My original posting () was more of a "what do you think?". I've done a lot more work on them, including supporting documentation, and hope to have a better release by the end of Monday.

    >apply the random variable concept
    There are now a slew of customizable random variables (sample attached)

    >I copied the code in Editor to new document
    The documentation will include a step-by-step guide to using the (new) application template to produce a secure copy of a document.

    >Am I missing a reference to something?
    No. You were wandering through a proof-of-concept idea. The final product will be better.

    Note too eagle-eyed Hans's comments below. Thanks Hans!
    Attached Files Attached Files

  12. #12
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Hans, thank you, I reopened my test doc and change the position of code. The document was a new document and I rang encrypt code which works but when I protect the doc with Password and save and Open File it just throws the error on my screen in 2007.

  13. #13
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Thank you Chris, you are very obliging.

    I dabble in VBA and when I see something I like I just have to see how it works! I always learn something such as code placement from Hans.

    Looking forward to your next post.

    Many thanks

  14. #14
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Protecting Course Notes. (Word2000+)

    You should save the document while it is encrypted but unprotected.
    If the user opens it and disables macros, the document will be encrypted (and the code to decrypt is not viewable) so it is useless.
    If the user opens it, enables macros and accepts the license, the code will first decrypt, then protect the document with a password based on the date/time.

  15. #15
    New Lounger
    Join Date
    Mar 2008
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting Course Notes. (Word2000+)

    Well, it just worked!

    I opened my train doc and delete the text/screenshot and put in =rand(5,3) for blank text and ran encrypt and saved and then password protected and saved and opened
    and said YES and it decrypted!

    Who knows - as I said I'm using 2007 and 2003 in tandem so who knows!

    But it worked!

    Thanks Hans

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •