+ Reply to Thread
Results 1 to 8 of 8

Disable print but allow PDF printing

Hybrid View

  1. #1
    Valued Forum Contributor
    Join Date
    01-03-2016
    Location
    Conwy, Wales
    MS-Off Ver
    2016
    Posts
    974

    Re: Disable print but allow PDF printing

    This works
    add a first line to Sub SaveQuoteAsPDF
    Sheets("Sheet1").Range("A10") - change this to whichever cell and sheet works for you
    Sheets("Sheet1").Range("A10") = "PRINT PDF"
    then amend the BeforePrint as follows (remember to reset that cell back to blank within the If...End if)
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
        If Sheets("Sheet1").Range("A10") = "PRINT PDF" Then
            Sheets("Sheet1").Range("A10") = ""
            Exit Sub
        End If
    Cancel = True
    MsgBox "You can't print this workbook"
    End Sub
    This adds as a switch.
    If the cell contains the value "Print PDF" then it allows printing
    Otherwise if cell is blank, no printing allowed
    Last edited by Kevin#; 03-03-2016 at 12:56 PM.

  2. #2
    Registered User
    Join Date
    11-16-2015
    Location
    bradford
    MS-Off Ver
    2013
    Posts
    18

    Re: Disable print but allow PDF printing

    This works great thanks.

    I have 2 other worksheets that need to follow the same rule, but the macro print button isn't in the same place, (roughly F9) and it takes the cell name from E21.

    This says it subscript out of range so how can I change the print range for these macros? I don't really understand how the range ("A10")makes it work?

  3. #3
    Registered User
    Join Date
    11-16-2015
    Location
    bradford
    MS-Off Ver
    2013
    Posts
    18

    Re: Disable print but allow PDF printing

    This works great thanks.

    I have 2 other worksheets that need to follow the same rule, but the macro print button isn't in the same place, (roughly F9) and it takes the cell name from E21.

    This says it subscript out of range so how can I change the print range for these macros? I don't really understand how the range ("A10")makes it work?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 06-11-2014, 09:23 AM
  2. Disable Print button in Full Print Preview
    By RaquelAR in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-17-2013, 02:03 PM
  3. Disable printing bar one sheet
    By Ad83 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-27-2012, 09:15 AM
  4. disable hyperlinks while printing
    By ravindar.thati in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-06-2009, 09:47 AM
  5. Disable printing problems
    By Simon-ch in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-19-2009, 11:21 AM
  6. Replies: 4
    Last Post: 02-17-2006, 08:36 AM
  7. [SOLVED] printing multiple print areas with a print dialog box
    By LHaro in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2005, 05:05 PM
  8. Disable Printing
    By JOHN SMITH in forum Excel General
    Replies: 2
    Last Post: 04-13-2005, 08:06 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1