+ Reply to Thread
Results 1 to 5 of 5

Disabling 'Print What - Entire Workbook'

  1. #1
    Registered User
    Join Date
    07-14-2011
    Location
    Chichester, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Question Disabling 'Print What - Entire Workbook'

    Hello, I've been searching hundreds of posts but not found an answer to this. I have a procedure that applies lots of formatting, filters, repaginates and then finally opens the print dialogue box with

    Application.Dialogs(xlDialogPrint).Show

    What I need it to do is disable / grey out the "Entire workbook" button so that my users can only print out the active sheet. It defaults to active sheet but I just know that someone will change it and get a lot of wasted paper.

    According to the help files and other posts, the 'Print what' section is governed by argument 7 but I don't know if this is where to disable an option or what value to pass to do this.

    Another option would be to get my procedure to run across all the sheets but this would take quite a bit of time (takes about 30s for one sheet) and the users would think something was wrong even if I popped up a message box telling them it would take a while.

    Any guidance on this would be greatly appreciated

    Thanks

    John

  2. #2
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Disabling 'Print What - Entire Workbook'

    Can you just use VBA to print the sheet instead of showing the Print Dialog?
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  3. #3
    Registered User
    Join Date
    07-14-2011
    Location
    Québec
    MS-Off Ver
    Excel 2003
    Posts
    9

    Re: Disabling 'Print What - Entire Workbook'

    Quote Originally Posted by davegugg View Post
    Can you just use VBA to print the sheet instead of showing the Print Dialog?
    Assuming you have already defined your print area, you could use something like:
    Private Sub Workbook_BeforePrint(Cancel As Boolean)
    ActiveSheet.Print
    Cancel = True
    End Sub

  4. #4
    Forum Expert davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2010
    Posts
    1,884

    Re: Disabling 'Print What - Entire Workbook'

    Thanks, I know how to do it, I was asking if that would work for the OP's purposes. : )

    I think if I were to do it, I'd create a userform as a custom print dialog, and only give my user's the print options I want them to have.

  5. #5
    Registered User
    Join Date
    07-14-2011
    Location
    Chichester, England
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: Disabling 'Print What - Entire Workbook'

    Hi Dave, I would need to recreate the whole print dialogue as I need the users to be able to select the printers (their own or networked) and change any other ranges etc. If I just printed directly from VBA then the correct printer might not be chosen.

    Items can be greyed out, at the moment 'Table' is greyed out when the dialogue opens so I think it must be possible and that is what is really bugging me.

    thanks

    John

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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