+ Reply to Thread
Results 1 to 3 of 3

Change Print setup when worksheet is selected

  1. #1
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Change Print setup when worksheet is selected

    I have some code that this Forum has help me build and now I have a need to change it.
    as the code states it will run when a “print” Commend or “Print Preview” Command is activated.

    When I wrote this code I was using Excel 2003, now I have been upgraded to Excel 2010
    Now the print Preview is different and the record macro does not give me any code.

    What I would like to do is change it so that when a worksheet is selected, then the "page setup" is updated for that worksheet only.
    This code was placed in the "workbook", to do what I need to do now, I believe what I would have to do is put it either in each worksheet or put a call into each worksheet

    Here is my code
    Please Login or Register  to view this content.
    Note:
    What is important to me is CenterHeader, this get info that the user has enter on the main worksheet and is need on print out for other worksheet only when printed, theses worksheets are also linked to other programs
    Last edited by CityMPLSEmpolyee; 02-01-2012 at 01:50 PM.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Change Print setup when worksheet is selected

    Hello CityMPLSEmpolyee ,

    The code you have will work in Excel 2010. The properties and events for the Workbook and Worksheet objects from 2003 work in Excel 2010. What problems are experiencing with the code?
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Forum Contributor
    Join Date
    09-30-2010
    Location
    Minnesota, USA
    MS-Off Ver
    Excel 2010
    Posts
    109

    Re: Change Print setup when worksheet is selected

    Thanks for your reply Leith Ross

    What the old code was not doing was (in excel 2010) in the Print Preview; I did not get the update for the “CenterHeader” (or anything else) until the print button was clicked

    (Note in the old code were you see “Private Sub Worksheet_BeforePrint(Cancel As Boolean)” the word “Worksheet” in my old was “Workbook”)

    Now after some testing & research on the internet the following code is what I’m going to use

    Code in worksheet
    Please Login or Register  to view this content.
    Code in module
    Please Login or Register  to view this content.

+ 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