You said you went to Alt+F11 > Normal > Microsoft Word Object >
ThisDocument to insert the macros the first time. If they're still
there, you can delete them -- they don't belong there.
If the person receiving your document has the security level set to
Low, they won't see any message. The macros will just work. (But that
would be stupid on their part, because *any* macro will just work, and
it could be a virus.)
If the person has the level set to Medium, which we recommend, then
there will be a message box every time they open any document that
contains a macro. The box has three buttons: "Disable macros", "Enable
macros", and "Cancel". If they click "Disable", the document will open
but the macros won't work. If they click "Enable", the document will
open and the macros will work. Finally, if they click "Cancel", the
document won't open.
If the person has the level set to High, there will be no message box,
and the macros won't work.
--
Regards,
Jay Freedman
Microsoft Word MVP
Hi Jay,
that was the answer that I was looking for, It works, thanks.
The only think that I didn't found is when you said: "(and remove them from
Normal)". Where are they?
Last stupid question. If the person that recive the document by me has the
macro security level in Medium or Low, in any case, when he open the
document see a dialog mask with "do you want active the macro?" or with a
message something like this?
PoaloB
Although I think what you did should have worked for your test, you
shouldn't have it in Normal if you want to have it work for other users.
Instead, do this:
Open the document that you want to protect from printing.
Alt+F11 > Project (Document name)
where "Document name" is the name of the open document
Then on the menu in the macro editor, Insert > Module. This will create a
folder named Modules below the Microsoft Word Objects icon, and it will
contain a Module1 icon. The title bar at the top of the editor should say
"Microsoft Visual Basic - Document name - [Module1 (Code)]" and the bid
window on the right should be empty (but if it says "Option Explicit" you
can leave that). Put the two macros there (and remove them from Normal).
Click File > Save. Then go to the main Word window and click File > Print.
Nothing should happen -- no dialog, no printing.
Another thing you could do is put a message on the screen when these macros
run. In each macro, put this line between the Sub and End Sub lines:
MessageBox "Printing of this document is not permitted."
Paolo B wrote:
I'll guess that you may have your macro security level set to High,
as I mentioned in my other post. That means that no macros can run,
so they aren't intercepting the built-in commands.
The other question is, where did you store the macros? For testing
purposes, they should be in a new module in one of these places: (1)
the document itself, (2) the template that the document is based on,
or (3) Normal.dot. For distribution to others, they must be stored
in the document. If the macros are somewhere else, they may not run
even though the macro security level is Medium or Low.
Hi Jay,
it doesn't run.
my macro securitu level is Medium.
The problem could be where i store the macro, tell me, please, if is
ok or wrong
VBA (ALT+F11) > Normal > Microsoft Word Object > ThisDocument
PaoloB