+ Reply to Thread
Results 1 to 6 of 6

Run sub before sheet is printed?

  1. #1
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Run sub before sheet is printed?

    I would like to force a sub routine to run whenever the File, Print command is used on a particular sheet. Is this possilbe?

    Yes, I have a custom Print button on the sheet, but the users can still select the File, Print command and print bad data.

    Yes I also know I can run the sub routine whenever it the sheet is activated, but the routine takes some time and I would rather not do that.

    Thanks for your help.

    Excel 2000
    Last edited by proepert; 05-22-2010 at 04:56 PM.

  2. #2
    Forum Contributor
    Join Date
    11-28-2005
    Location
    Dover, England
    MS-Off Ver
    365
    Posts
    172

    Re: Run sub before sheet is printed?

    Could you not create your own menu options and toolbars, so that only your print button is available.

  3. #3
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: Run sub before sheet is printed?

    You could use a BeforePrint event macro in a workbook module.

    Please Login or Register  to view this content.
    This is triggered when any sheet is printed. If the specified sheet is to be printed it will run your sub, otherwise it will just print as normal.

  4. #4
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Question Re: Run sub before sheet is printed?

    Thank you very much.

    This works when the sheet is selected, but how can I also run the sub when the "Entire Workbook" option is selected in the Print dialog box?
    Last edited by proepert; 05-21-2010 at 06:43 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    08-23-2009
    Location
    Hampshire, UK
    MS-Off Ver
    Excel 2003, Excel 2007
    Posts
    328

    Re: Run sub before sheet is printed?

    You could prevent people from printing the entire workbook. The code below will only allow the active sheet to be printed.
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    11-17-2009
    Location
    PA USA
    MS-Off Ver
    Excel 2000
    Posts
    184

    Re: Run sub before sheet is printed?

    Thank you very much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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