Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need to permission a file so that the user cannott print it. 2

Status
Not open for further replies.

davezach

Technical User
Oct 15, 2002
2
GB
I have a situation where I need to disable printing a file. Its a word document and the os is 2000. The user still needs to edit the document but should not be able to print it.I would appreciate any suggestions.
 
No way this can be done, unless you remove printing capability for everything for this user.
 
OK :) Stupid Question here.

Why would you not want somoene to have the ability to veiw but not physically print a file??? Just curious
 
You probably can't stop everyone from printing, but there are steps you can take that would stop some/most.

You could start by customising the toolbars. Right click on a toolbar and choose Customise. On the Commands tab you can drag and drop buttons to and from the toolbars. So you can remove Print and probably Print Preview from the file menu, then remove the Print button from the Standard toolbar, you might even choose not to display the Standard toolbar (remove the tick next to it on the Toolbars Tab).

I've not done the next bit but you could try assigning Ctrl + P to a macro that displays a dialog that says printing is disabled.

Anyone got any other ideas?

bandit600
 
Having re read your post it is only the one file you want to disable.

Therefore you will need auto open and auto close macros to disable and then re enable printing. You could also then stop the toolbars from being customised back.

If you repost in the VBA forum, I'm sure someone will be able to help.

bandit600
 
Sorry to repost on such an old topic but I am also looking for an answer to this.
There are very good reasons for not allowing users to print a document. We have some Quality Control documents on how we run our business. The Quality Auditors do not want to see pages of these manuals floating around the lab. It needs to stay in one place. We used to have several controlled books in the lab, but with the network, it has been put in one location on the server for all to access as read only. We want to limit the printing capability of these files. Changing them to PDF or something else is an option. Anyone out there figure this out yet?
 
Here is code that disables printing by user name. The user name is picked up from Word's User Information. To really be careful you should use the Windows API to get the logon name, compare it to the application username. In any case, essentially you set a variable by the identification of a user(s), and then check that variable whenever the print commands are called. You could of course make the variable boolean = if Bob = true etc etc.

Note the variable should be public so it can be available for all commands.

Code:
Option Explicit
Public intNoPrint As Integer

Sub FilePrint()
    'Overrides the File Print command
    If intNoPrint = 1 Then MsgBox "This document can not be printed."
End Sub

Sub FilePrintDefault()
    'Overrides the Print button
    If intNoPrint = 1 Then MsgBox "This document can not be printed."
End Sub

Sub NewPrint()
    If intNoPrint = 1 Then MsgBox "This document can not be printed."
End Sub

Sub MailMergeToPrinter()
    'Overrides Alt+Shift+M
    If intNoPrint = 1 Then MsgBox "This document can not be printed."
End Sub

Sub OptionsPrint()
    If intNoPrint = 1 Then MsgBox "This document can not be printed."
End Sub

Sub AutoOpen()
Dim uName As String
uName = Application.UserName
'  obviously you want to change this
If uName = "Bob" Then intNoPrint = 1
End Sub

When "Bob" opens the file, he can typed, edit, save...but not print.

Gerry
 
Thanks. That looks good, just let me make sure i understand it. Does this code get inserted into the document? So I have 30 users, do i have to check each of their names? if yes, can i write it the other way where it allows print by user name, that would only be about 3 people. This would also be cool if the file was copied to another PC with a user name I do not know.
 
The above code will only stop some and slow other novice users down.

1) Alt-PrintScreen will still copy the active window to the clipboard where it can then be pasted and printed.

2) Highlighting the text and Ctrl-C/Ctrl-V still will work too.

3) A simple SaveAs will also bypass most of the printing restrictions.

*Remember.......
If you don't use your head,
your going to have to use your feet.
 
1. Yes, it is inserted into the document, a module.
2. You can put it any way you like.

Say you have 30 people, of which only 3 you want to be able to print.

Still keeping the variable for username,

Code:
Sub AutoOpen()
Dim uName As String
  uName = Application.UserName
  Select Case uName
     Case "Bob", "Harry", "TheGuyWhoCanPrint"
        intNoPrint = 0
     Case Else
        intNoPrint = 1
  End Select
End Sub

The logic is still there for the case of an unknown user. An unknown is still not Bob, Harry, or TheGuyWhoCanPrint.

You could also do it as a password. Don't know the password - can't print. I would not recommend this however, people will simply pass on the password.

Hope this helps.






Gerry
 
Thanks for the info Fumi. This will be very helpful. And yes I know the text can still be printed...copied...whatever, just as i could photo copy the pages from our orginal books.
 
Meintsi is correct. The examples given will, in fact, work. However, you can override them as well. I just did not include them as the question was specifically on printing. For further information (at least regarding Word) see:

Word Override Commands

Warning: the override.dot file from Microsoft overrides everything. Including being able to close the file. Do NOT open the file unless you have the VBA Editor open already. That way you can disable the disable. I keep my sample with the Alt-F4 command still valid. At least I can close it then. Again, all close routines are disabled in the original.

Final note: these Word override commands will override everything except Alt-PrintScreen. This is a Windows command, not a Word command - so, yes, you could make a graphic image of the text and print. However, override.dot shows how to disable Ctrl-C & V (as these are also Word commands) - so you can not copy or paste.



Gerry
 
You mentioned early on that Adobe might be an option. With adobe security you can lock down the PDF so that with a valid password the document can be printed.

You must have the full version of adobe to enable security. Basically, you can lock down the PDF so that the contents cannot be copied (highlight with the mouse), printed or saved as a new document. If you want to enable any of these features you'll be prompted with a password box. And it's nearly impossible to break the password security.

It's pretty easy to convert a document (word, word perfect, etc) to PDF, just open it, and "Print" to PDF Distiller (once you have the full version).

Just another option that is guaranteed to work.

Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top