Macro to change background color

K

KC Rippstein

Hello!
I have a sensitive Word document that I am trying to put some controls on.
- First, I require a password to even open the file.
- Then another dialog box requires another password to edit the file or you
are forced to open as read-only.
- Finally, I created a macro that disables printing automatically upon
opening, but there's a catch...the user can simply disable macros or hold
down the shift key when opening the file.

So, here's my thought. What I'd like to do is set the background of the
entire document and all tables to black and create a macro that changes all
of it back to white. Only my header rows in each table have a different
color, all else is white. Since the doc is protected, they cannot manually
change it and will be forced to re-open the document and accept my macro.
This is for internal use only, so the trust factor will not be an issue.

Can you help me write a simple VBA code that changes the background of the
entire body and all tables to white again? I see an example in the forum
for changing all tables to a color, but that example does not alter the
actual document background, too. I also need to incorporate the password
into it to allow formatting change and then set the protection back on
again, and I need it to keep the color of table header rows correct.

And I am not worried about them using Alt+PrintScreen, as most folks are not
familiar with that. The main thing we want to accomplish is prevent anyone
from accidentally sending this to someone or leaving a printed copy on their
desk.

Thanks so much! I use advice from these forums every day...you are all
fantastic!
- KC Rippstein
 
G

Greg Maxey

Perhaps something like
If ActiveDocument.Background.Fill.Visible = True Then
ActiveDocument.Background.Fill.Visible = False
End If

This approach seems rather convoluted.

Perhaps the national repository at Fort Knox is better suited for this
document ;-)
 
K

KC Rippstein

Many thanks. That meets my needs perfectly. I put that in the document
open macro and put its reverse in the document close followed by a save
command. I also figured out how to see if the protection was on or off and
change it accordingly through each step. Now it does exactly what I need!

You think I'm being paranoid, eh? You may be right. Requiring a password
to open the thing should be enough of a deterrent to prevent accidental
sharing, especially when the password is DoNotShare !

Your help is MUCH appreciated!!!!
 
A

aalaan

Never came across the *publication* of a password before! Nearest was a
prize computer room at a publisher. Behind a glass screen in reception was a
computer system. On large dymo tape to the front of the main monitor was
"SECRET PASSWORD: BLOGGINS" It probably still works...
 

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