How can I prevent others printing a worksheet
How can I prevent others printing a worksheet
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: How can I prevent others printing a worksheet

  1. #1
    Guest

    Default

     
    I want to allow others to view a workbook as read only (which is not a problem) but I can't work out how to prevent them from printing it.

    I still need to print it myself.

    Many thanks for your help.

    Bazil

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Using VBA you can do this. On the worksheet object you could put this code in :


    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    Cancel = True
    End Sub



    This is not a perfect solution, but it does stop them from printing.

  3. #3
    Guest

    Default

    This is a fairly "simple" solution which doesn't use macros, but it works fine.

    Put your cursor in cell A1 - make sure that row 1 is empty as you will be hiding it later. Goto File, Print Area, Set print Area. Select row 1 and hide it, then protect the sheet. If someone tries to print it will print a blank page as the print area does not contain any info. You hide row A to prevent anyone moving the page breaks (which you can do even if the sheet has been protected), but you cannot unhide a row if the sheet has been protected.

  4. #4
    MrExcel MVP lenze's Avatar
    Join Date
    Feb 2002
    Location
    Helena, MT
    Posts
    13,690
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Try this code in the WorkBook Module.

    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    'Input box to verify password

    Dim myPassword As String

    myPassword = InputBox(prompt:="Please enter the password to proceed:", _
    Title:="Password is required to print this file.")

    If myPassword <> "Password" Then
    MsgBox prompt:="Click OK to return to Report.", _
    Title:="Cancelled -- correct password not entered", _
    Buttons:=16
    Cancel = True

    Else
    End If
    End Sub

    Change "Password" as desired

  5. #5
    Guest

    Default

      
    Many thanks for the quick replies - excellent stuff.

    Bazil

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com