Results 1 to 15 of 15

Print using Add-in Only (Excel 2010, VBA)

Threaded View

  1. #1
    Forum Contributor
    Join Date
    03-22-2012
    Location
    OR, USA
    MS-Off Ver
    Excel 14/2010
    Posts
    273

    Print using Add-in Only (Excel 2010, VBA)

    I am trying to disable the PRINT function being used be separate workbooks. The only time I want it to print is using an AddIn. I have attached an example. It shows the messagebox but then allow the Excel Print function to work without using the AddIn. Additionally, the AddIn is getting the messagebox.

    Book1 in ThisWorkbook
    Public Sub Workbook_BeforePrint(Cancel As Boolean)
        Cancel = PrntOK
        MsgBox "You can't print this workbook"
        Exit Sub
    End Sub
    AddIn Code (partial)
    Public Sub PrintDoc()
    
        name = UCase(Application.UserName)
        ctrlNbr = "12345"
        PrntOK = True
        Call PrintDocX(name, ctrlNbr)
        PrntOK = False
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 05-20-2015, 07:23 PM
  2. Excel 2010, Excel 2013 BeforePrint Event Trigger (Before Print Preview)
    By mikepfly2 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-13-2015, 03:43 PM
  3. Excel 2007/2010 Print Macro
    By Cansa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-29-2014, 11:35 PM
  4. Disable Print Preview in Excel 2010
    By Sophie.Durrant in forum Excel General
    Replies: 1
    Last Post: 12-21-2012, 05:53 PM
  5. Excel 2010 Print Command
    By Tendon in forum Excel General
    Replies: 1
    Last Post: 06-16-2011, 02:35 AM
  6. Excel 2010 print/print preview error for combo boxes
    By dlmcdan in forum Excel General
    Replies: 3
    Last Post: 03-23-2011, 12:32 PM
  7. Excel 2010 Print Preview
    By diesellam in forum Excel General
    Replies: 0
    Last Post: 03-09-2011, 04:07 PM

Tags for this Thread

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