+ Reply to Thread
Results 1 to 4 of 4

Userform to Select and Print or Export to PDF

  1. #1
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Userform to Select and Print or Export to PDF

    I'm working to develop a userform for a Excel file that has about 50+ worksheets in it. The userform should provide a listing of all visible worksheets minus a couple of sheets that should never be printed (but can't be hidden)

    I figured out how to list all of the worksheets in a multiselect check box and have created a couple of placeholder command buttons, one each to either print, or save/export to PDF. But I'm currently struggling with the command button code. I "think" I need to first group all the selected sheets into an array, and then print the array or export to pdf. It should work so that only 1 PDF file is created based on the selected sheets.

    This is the basic form code thus far, but is still empty for the command buttons.

    Can anyone provide some starter tips?
    Also, is there a better way to group/code the worksheets that should not be included in the listbox?

    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Userform to Select and Print or Export to PDF

    Well,

    Still unsure if I'm going in the right direction, but I worked some last night trying to place all the selected worksheets from the multi select listbox into an array of sheets. And would then eventually work to print or export that to PDF.

    so this is my current (not working) but incomplete attempt thus far. I hope to read and explore some today if I can get some more time.

    Please Login or Register  to view this content.

  3. #3
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Userform to Select and Print or Export to PDF

    I think I've gotten most of this figured out, however I hit a snag where Excel is actually locking up on me when I attempt to print preview the selected workpapers.

    This is the code being used to printpreview the worksheets selected from the userform multi select. The print preview opens, however the userform does not unload and Excel seems to hang.

    EDIT.
    I found that unloading the userform before print previewing seems to solve the issue. I did find most of the code through various searches though, so not sure if it can be improved on or not.

    Please Login or Register  to view this content.
    Last edited by ptmuldoon; 03-01-2015 at 08:44 PM.

  4. #4
    Valued Forum Contributor
    Join Date
    04-24-2014
    Location
    United States
    MS-Off Ver
    Office 365 ProPlus
    Posts
    853

    Re: Userform to Select and Print or Export to PDF

    In a follow up from last night. While I thought the below was working correctly, it appears that when the print preview is loaded, Excel is only showing and then printing the first worksheet, and not all of the worksheets selected in the userform.

    I'm off to google for more help. But how to you get all the selected worksheets to show in print preview and to print in one piece vs separate print jobs for each worksheet?

    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)

Similar Threads

  1. How to put into userform that can select number of page to print using userform?
    By reimar_rem in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2013, 11:33 PM
  2. [SOLVED] Debug Print select worksheets userform
    By cammyjane10 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2013, 01:59 PM
  3. Replies: 4
    Last Post: 02-17-2006, 08:36 AM
  4. [SOLVED] Create a print macro that would automatically select print area?
    By wastedwings in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 10:05 AM
  5. Create a print macro that would automatically select print area?
    By Ron de Bruin in forum Excel Formulas & Functions
    Replies: 14
    Last Post: 09-06-2005, 06:05 AM

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