+ Reply to Thread
Results 1 to 9 of 9

Exclude printing a specific worksheet in a workbook

  1. #1
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Exclude printing a specific worksheet in a workbook

    Hi

    I use the following macro to print pages with data but, have added another worksheet that is filled with data that I do not wish to print. Can you help please with how I exclude a worksheet called Time Calc?

    Please Login or Register  to view this content.
    Last edited by Steven811; 08-28-2012 at 12:19 PM. Reason: No tags

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Exclude printing a specific worksheet in a workbook

    Hi, Steven811,

    please use Code-Tags to display your code.

    Use the event in ThisWorkbook
    Please Login or Register  to view this content.
    Ciao,
    Holger

  3. #3
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Re: Exclude printing a specific worksheet in a workbook

    Thank you for the prompt reply. I'll give it a try.

    I did use the tags and they show in the preview, hmm.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Exclude printing a specific worksheet in a workbook

    Hi, Steven,

    maybe another demand on the vBulletin team: this forum is "not in harmony with the rest of the world": slow in response (canīt be that many users in the database by the same time), not showing all features, sometimes even not willing to communicate with the users (like on Sunday) - a board of wonders

    Thanks for adding the tags.

    Ciao,
    Holger

  5. #5
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Re: Exclude printing a specific worksheet in a workbook

    Hi Holger

    I've fixed the tags issue, my stupid mistake.

    I haven't worked with this spreadsheet for a while and I've created a new module and inserted the code, then becuase that didn't work I've experimented with inserting it into the print routine and that didn't go so well either.

    Could you advise me where to put this code please?

  6. #6
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Exclude printing a specific worksheet in a workbook

    Hi, Steven811,

    my example is an event that is triggered whenever any kind of printing takes place (even a Preview). This event needs to be placed in ThisWorkbook, not a normal module, not behind a sheet.

    You could amend it to first check for the sheet name to cancel and else call the macro:

    Please Login or Register  to view this content.
    This event will be called from all printing items in the workbook that Excel delivers.

    HTH
    Holger
    Last edited by HaHoBe; 08-28-2012 at 10:48 AM. Reason: will be triggerd by Print or PrintPreview on Menu

  7. #7
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Re: Exclude printing a specific worksheet in a workbook

    Hi Holger

    I have noticed that there is now an issue with printing the worksheets. For some reason when I reordered the worksheets the sheets with data namely

    "Info", "Logos 1" and Logos 2" do not print, only "Info"
    Emily Roberts_3.2.xlsm
    The pages that need to be excluded are "Time Calc", "Quotation", "Print PO"

    I've added the spread sheet if that helps.

    Any ideas would be gratefully received.

    Thanks

    Steven811
    Last edited by Steven811; 08-28-2012 at 12:40 PM. Reason: Error with running the code

  8. #8
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: Exclude printing a specific worksheet in a workbook

    Hi, Steven811,

    Sheets("Time Calcs") will print as only Sheets("Time Calc") is checked (Typo).

    The event in ThisWorkbook was missing. I added that but changed the code to

    Please Login or Register  to view this content.
    I checked the procedure with all cases of the first instance in PrintPreview - and they didnīt show up (what was expected, but Info was displayed when tested). Like explained earlier I just used Excelīs own commands for Print/PrintPreview.

    I would like you to check as well. Please feel free to come back if anything is not working the way you expect it to be.

    Ciao,
    Holger

    *****
    Sorry but I missed the typo although I mentioned it in my post. Please correct the name to Time Calcs. Thank you
    Attached Files Attached Files
    Last edited by HaHoBe; 08-28-2012 at 03:26 PM.

  9. #9
    Forum Contributor
    Join Date
    02-17-2005
    Location
    Wokingham
    MS-Off Ver
    365
    Posts
    101

    Re: Exclude printing a specific worksheet in a workbook

    Hi Holger

    Thank you for your assistance.

    The print macro was designed to print only those pages holding current job data and they are "Info" and Logos 1 through to Cap logo. Everything else is excluded. With the event code in ThisWorkbook I'm printing out only the info page and none of the logos pages.

    I've now moved all of the Time Calcs data to "Machine logo costs" and deleted the work sheet "Time Calcs" the print macro works correctly.
    Last edited by Steven811; 08-29-2012 at 04:36 AM. Reason: Typo

+ 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