Locking form

R

rlampky

Is there a method using VBA that at the completion of a form, the user can
lock the document so that no alterations can be made when it is reopened.
(needs to be stronger than protect/unprotect)

This would probable include deleting the attached macros or some other
finalization via the toolbar so that the document can viewed, but not
altered?
 
S

Steve Lang

You pretty much have two options:

1. Create a locked PDF. Your best bet.

2. Encrypt the document with a password to make it read-only. I believe the
encryption is 128 bit; if so, it is pretty robust. However, this won't
disallow someone from opening the document (in read-only mode), copying the
contents and creating a new, identical document which is no longer password
protected. Then, if the person has write permissions to the directory where
the original is stored, voila! the what you thought is locked, is no longer
the same as the original and is no longer protected.

HTH and have a great day!

Steve
--
Stephen Lang
Legislative Counsel Bureau
Carson City, NV
GMT+8
slang at lcb <dot> state <dot> nv <dot> us
 
C

Charles Kenyon

If a document can be view / read, it can be copied and altered.

You could use an on-exit macro for your last field in a form that disabled
text entry in all of the formfields. This would leave you with a
non-editable protected form. If you password protect your vba and use a
password for protecting the form this is tight. However, form protection is
easily defeated. It would take any of the MVPs or regular
contributors/readers here perhaps five-fifteen minutes. Steve Lang's
suggestion for converting to pdf is helpful but would leave you with the
original plus the pdf.

My opening remark applies to pdf files as well. You can make it hard to make
changes, you can't make it impossible.

What you are talking about is what Word calls an "online form." For more
about online forms, follow the links at <URL:
http://addbalance.com/word/wordwebresources.htm#Forms> or <URL:
http://word.mvps.org/FAQs/Customization/FillinTheBlanks.htm> especially Dian
Chapman's series of articles.

Hope this helps,
 
R

rlampky

Thanks,

What about a VBA macro that disabled the form fields and would from that
point on indicate that the form has been altered if it was edited or
changed after saving?

Along with teh VBA password, and other suggested options.
 
C

Charles Kenyon

The added vba would have no use. If they change it, they are changing it in
a different document which would not inherit the vba.
 
S

Steve Lang

Depending on your environment, you could have the data from your form fields
uploaded to a database, which you can adequately secure. Any further
attempts to overwrite the data in the database could trigger alerts, create
additional datasets, or any number of things. This way, you could trust the
integrity of the data. The fact that it was created in Word would be
irrelevant.
Just a thought.

Steve
 
R

rlampky

Can you do via VBA a Word count, place it into an algorithm, and store the
created hash or value, in a bookmark ( hidden or not viewed ) then when the
document is reopened have a similar macro verify the number and compare it
to the value and use a if statement to insert something like a watermark
indicating the document has been changed?
 
J

Jay Freedman

There are fatal problems with any attempted VBA "solution":

- If the macro is in the template, it doesn't travel with / can be
disconnected from the document.
- If the macro is in the document, the High and Medium security levels can
disable the macro. Saving the document in RTF strips off any macros, as does
copying/pasting to a new document.
 

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