+ Reply to Thread
Results 1 to 13 of 13

Select checkboxes on a userform to save to PDF and e-mail

  1. #1
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Select checkboxes on a userform to save to PDF and e-mail

    Hi. I have created a userform with checkboxes to select which sheets of my workbook must be saved to PDF and emailed. Currently the code is working, but the only problem is that not only the selected sheet is saved but all are saved. I need help on how to change my code for only the selected sheets to be saved and emailed.

    Form.jpg

    Please Login or Register  to view this content.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Kolein

    Welcome to the Forum!!

    This Code is untested...if you wish tested Code please attach your File WITH Code.
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Jaslake

    I have tried similar code then yours and could not get it working. No matter which checkbox is ticked it only saves the Confirm sheet to pdf. the problem is with the sheets array to select all the sheets. Attached is a file to test. Thanks
    Attached Files Attached Files
    Last edited by Kolein; 09-20-2014 at 10:27 AM.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Kolein

    In looking at the revisions in the Code I'm not certain what it is you're trying to do. Please explain in words.

  5. #5
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    On the userform is 6 checkboxes, If i only need to select 2 of the or 3 or all six or only one. I want only to save those where the checkboxes has been checked to pdf and email them. Not all the pages is always applicable, say maybe the first 3 is needed, next time all six is needed to be emailed. I need to be able to choose which pages/sheets I want to save and the email.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Kolein

    Will the PDF always be named this?
    Please Login or Register  to view this content.
    You cannot have two PDF's of the same name...

  7. #7
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Kolein

    Try this for your Command Button Code...notice the Control Tip Text for each Check Box...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Jaslake.

    To answer your question about the name of the PDF - yes it will always save as that, because for each job a new file is created and it has a unique reference number and with formulas this reference is then used to save it to PDF.

    I need to thank you as I have tested the code and it works. I can add more checkboxes as the need arise. The control tip text is very important otherwise an error message of subscript out of range pops up.

    Thank you very much for your help, I have learned something new.

    Regards

    Kolein

  9. #9
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Jaslake

    As per previous post the coding works. I have now discovered that when the pages is hidden I get the subscript error. So I must find a way to unhide them, the most of the time these pages are hidden and they need to be unhide to be saved.

    Regard

    Kolein

  10. #10
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi

    I got it to work now. Here is my code.

    Please Login or Register  to view this content.

  11. #11
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Kolein

    Try these changes
    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    09-18-2014
    Location
    South Africa
    MS-Off Ver
    Office 365
    Posts
    7

    Re: Select checkboxes on a userform to save to PDF and e-mail

    Hi Jaslake

    Thank you for all your help my template is working now.

    Regards

    Kolein

  13. #13
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Select checkboxes on a userform to save to PDF and e-mail

    You're welcome...glad I could help.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

+ 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. Select series(lines) in a line graph by adding userform with checkboxes on a chart
    By aab_489 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2014, 12:25 PM
  2. VBA Userform: Warn user if all checkboxes on a userform are unticked.
    By MrMiyagi in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-07-2014, 12:08 AM
  3. Extract XLS* attachments from select mails, save mail info into fields
    By Alteregoist in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-14-2013, 05:35 AM
  4. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM
  5. Userform vlookup with the ability to save or select values
    By jpruffle in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 04-06-2009, 12:16 PM

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