+ Reply to Thread
Results 1 to 7 of 7

Ungroup selected worksheets after Before_Print event

  1. #1
    Registered User
    Join Date
    03-09-2007
    Posts
    75

    Ungroup selected worksheets after Before_Print event

    Hi all,

    Been trying to check whether I can ungroup all selected worksheets (that I have group as a array for printing) but has been unsuccessful. The reason being that I am using workbook before print event to control only certain worksheets will requires this type of array printing and after grouping and printing, the workbook befoer print event cannot help me ungroup those worksheets and switch back to the original worksheet that I had activated the print command (using Ctrl + P) or print .

    Can anyone advice how I can circumvent this?

    Thanks.
    CL

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Ungroup selected worksheets after Before_Print event

    Simply at the bottom of the Before_Print add Call MyMacro where MyMacro is your standard module macro that selects another sheet or does whatever you want
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    03-09-2007
    Posts
    75

    Re: Ungroup selected worksheets after Before_Print event

    Hi Simon,

    Thanks for the quick reply but it does not work.

    I am actually allowing users to choose the printers to print from (may be hardcopy or PDF etc.). But before choosing the printer, excel will automatically (with workbook before print event) adds another appendix worksheet to the end of the current worksheet to be printed (by using
    Please Login or Register  to view this content.
    But the problem now is that users will need to manually click shift + "Appendix add sheet" off to get back to "Print Sheet".

    Your suggestion will make it go back to "Print Sheet" even before the actual printing and thus I will miss out the "Appendix add sheet"

    Is there a way to circumvent this or I should relook at my code or just simply leave it to users to manual select back to "Print Sheet" to work on. It will be best if there is a "workbook after print event".

    Cheers,
    CL

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Ungroup selected worksheets after Before_Print event

    Quote Originally Posted by clng View Post
    Hi Simon,

    Thanks for the quick reply but it does not work.

    I am actually allowing users to choose the printers to print from (may be hardcopy or PDF etc.). But before choosing the printer, excel will automatically (with workbook before print event) adds another appendix worksheet to the end of the current worksheet to be printed (by using
    Please Login or Register  to view this content.
    But the problem now is that users will need to manually click shift + "Appendix add sheet" off to get back to "Print Sheet".

    Your suggestion will make it go back to "Print Sheet" even before the actual printing and thus I will miss out the "Appendix add sheet"

    Is there a way to circumvent this or I should relook at my code or just simply leave it to users to manual select back to "Print Sheet" to work on. It will be best if there is a "workbook after print event".

    Cheers,
    CL
    In your Before_print
    Please Login or Register  to view this content.
    in a standard module
    Please Login or Register  to view this content.
    That should work for you!
    Last edited by Simon Lloyd; 07-27-2010 at 11:58 PM.

  5. #5
    Registered User
    Join Date
    03-09-2007
    Posts
    75

    Re: Ungroup selected worksheets after Before_Print event

    Hi Simon,

    Am wondering whether your method works when user do action such as "Ctrl + P" or click file + print? This is because when user click print, the printer dialouge box will appear, but this is after all macro in the "workbook before print" has been activated. so in your recommendation, I assume that the printer will be activated twice. I cannot test it now as I am out of office, will try your method tomorrow and post again.

    Cheers,
    CL

  6. #6
    Registered User
    Join Date
    03-09-2007
    Posts
    75

    Re: Ungroup selected worksheets after Before_Print event

    Hi Simon,

    Still unable to figure out how to execute a new macro immediately after a print command. I had tried your method but the sub-routine still gets "trapped" and is being executed in the "Before Print" event. I am looking for a "After Print" solution.

    Please kindly help.

    Cheers,
    CL

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161

    Re: Ungroup selected worksheets after Before_Print event

    Follow my original instructions for the 2 pieces of code i gave you but use this as i've made a slight amendment

    Before_print
    Please Login or Register  to view this content.
    Standard module
    Please Login or Register  to view this content.
    This will work perfect for you!
    Last edited by Simon Lloyd; 07-27-2010 at 11:58 PM.

+ 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