+ Reply to Thread
Results 1 to 4 of 4

Don't print certain worksheets

  1. #1
    Registered User
    Join Date
    11-24-2008
    Location
    ohio
    Posts
    19

    Question Don't print certain worksheets

    I developed a workbook that uses three worksheet tabs to hide or expand other worksheets. So they kinda act like macro buttons rather than worksheets. I put a red note on those sheets that says "If you can read this content then you don't have macros enabled". I did this so when I give the workbook to others and they click on one of the hide or expand tabs and they didn't enable macros they will know why things are not working.

    The problem is when I give the worksheet to someone and they want to print the entire workbook the worksheet tabs that I use for the hide and expand also print. This is useless because all they have in them is the note about enabling macros. Is there a way to run a macro automatically before someone prints that will print all worksheets except the three worksheets with the names "ShowHide1", "ShowHide2", and ShowHideAll" when the entire workbook option is selected in the print window? I basically don't want the person to have to select all the other sheets and use the print active sheets feature.

    Thanks

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Don't print certain worksheets

    You could use the Workbook_BeforePrint event and exclude the workbooks like so.
    This code goes into the workbook module.

    Note: as with all macro code, functionality is entirely dependent on users choosing to enable macros.

    Please Login or Register  to view this content.
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    11-24-2008
    Location
    ohio
    Posts
    19

    Re: Don't print certain worksheets

    Hmmm. this looks right but it didn't work. When I hit file->print and use the entire workbook option it still prints those three worksheets.

    I pasted the code into the "ThisWorkbook" under Microsoft Excel Objects. When I select the "ShowHide1" worksheet in the VBAProject window the property called (Name) is ShowHide1. The actual text in the tab in excel is called "UPS 1 Expand". I tried putting the "UPS 1 Expand" in instead of "ShowHide1" but the print dialog box never comes up when I do that

    Any help would be appreciated.

  4. #4
    Registered User
    Join Date
    11-24-2008
    Location
    ohio
    Posts
    19

    Re: Don't print certain worksheets

    Any ideas on why it still prints the sheets called out in the script? I have macros enabled.

+ 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