+ Reply to Thread
Results 1 to 19 of 19

Print selected worksheets in pdf at selected destination

  1. #1
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Print selected worksheets in pdf at selected destination

    Hi,

    I want to print the selected worksheets in pdf at D:\Output automatically instead of one by one manually.I have already have a PDF printer installed.The filename of each PDF should be as that of worksheet name.

    Any help will be appreciated.

  2. #2
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Hi,

    I have found the code
    Please Login or Register  to view this content.
    but here I want the filename to be extracted from the current sheet as : MID(A7,16, till last character)&","MID(A8,11,till last character)
    i.e in Nutshell,it should extract the filename from A7 after ":" &","& A8 after ":"

    How this can be incorporated in the above code.

    I will be eagerly waiting for kind reponse.

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print selected worksheets in pdf at selected destination

    You will get a better and faster response if you upload a sample workbook.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    Lewis

  4. #4
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Thankx for the reponse.Ultimately after googling I found the code which is as follows
    Please Login or Register  to view this content.
    And it worked.

  5. #5
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Thanx for the kind concern to this query.
    Last edited by paradise2sr; 12-25-2017 at 08:29 AM.

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print selected worksheets in pdf at selected destination

    Hi,

    Try the attached file which I hope meets all your requirements to process several items at a time. I implemented the following.
    a. Replaced 'Active X' CommandButtons with Forms CommandButtons.
    b. When Creating CheckBoxes added 'LinkedCell underneath the CheckBox.
    Linked Cell' formatted tohide contents with 3 semi-colons ';;;'
    When processing checkboxes now look for 'TRUE' or 'FALSE' in the Underlying Cell.
    c. Updated the code per User request and removed all proprietary information.
    d. I sanitized the file, so there should not be an sensitive information.

    I formatted the 'PrintArea' for 1 Page Tall by 1 Page wide so the output would always be ONE PAGE:
    Please Login or Register  to view this content.


    Appropriate code excerpts follow:
    Please Login or Register  to view this content.
    Lewis

  7. #7
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Thanx a lot for your kind response.This seems to be more benefited.

    One more things if possible.Can you add a separate option that the data be exported into word in a single file,similar like mail marge by a macro whereas other code remain intact.

    Hoping a positive response in this regard.
    Last edited by paradise2sr; 12-28-2017 at 10:49 AM.

  8. #8
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Also,the module : Mod2_UDF_spell_..... has been modified,hence the output value is not interpreted in words which was earlier done.I want this to be left intact.Currently it is in big bracket giving result as [****** Simulation 1900800******] which is absurd.

    In addition to above,if possible,I would prefer few things-

    1.Create pdf file : Yes ...........(this is very nice which you have already done)
    here in this I want further an option to be added whether individual or in a single pdf file.

    I mean to say,when I click on 5 selected it is creating 5 pdf file which is fine.I want further an option to merge all this 5 pdf file into a single pdf file.

    OR, say you can add an option whether pdf file is required separate pdf or a single pdf file based on this choice it can be opted anyone.

    2.I want same result in word

  9. #9
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print selected worksheets in pdf at selected destination

    I will work on your requests. It may take several days, since Microsoft Word VBA is difficult for me to work with.

    Also,the module : Mod2_UDF_spell_..... has been modified,hence the output value is not interpreted in words which was earlier done.I want this to be left intact.Currently it is in big bracket giving result as [****** Simulation 1900800******] which is absurd.
    You sent me a PM with a link to your file, which you said had sensitive information in it. I removed anything that I thought might be sensitive. I removed your code module Mod2_UDF_spell_nepalese and replaced it with a new 'simulated module', in case the other module had sensitive information.

    You can currently fix it yourself by deleting my module, and replacing it with a module from your original file.

    Lewis

  10. #10
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    I am not in hurry.Pls take your time as long as you require.And thanx for your kind interest.I will surely wait.

  11. #11
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print selected worksheets in pdf at selected destination

    Hi,

    Try the attached file.

    Microsoft Word DOES NOT play nicely with other applications. I was able to user the 'format' sheet to create files in Word, but the results were extremely ugly. I took a second approach, which uses a 'Master Word file' that looks like Sheet 'format'. To allow you to make changes without need for VBA code, the 'Word' sheet uses a 'Pseudo Mail Merge' technique. There are sentinels in the Word file like <G5> which means use the contents of Cell 'G5' from the Excel Sheet being processed.

    The following instructions/information are in the file:
    Setup Instructions:
    a. Modify the constants at the top of code module ModMain if the position of any of the green cells in Column 'L' changes.
    b. Modify the constant at the top of code module ModMain if the name of the 'Master Source Word File' changes.
    c. The 'Master Source Word File' MUST be in the same folder as this file.
    d. Checkboxes on Sheet 'data' DO NOT have to be manually deleted. Delete the data, the select the 'Add CheckBoxes' CommandButton' on sheet 'Master'.
    Sheet 'data' DOES NOT have to have data on every line.

    Master Source Word File:
    a. The 'Master Source Word File' looks similar to the contents of Sheet 'format'.
    Sheet 'format' can not be used to create 'Word Files', because a perfectly good letter format
    in Excel looks terrible when copied to 'Word' (unless an image of the Excel sheet is desired).
    b. File 'ExcelForumCreatePdfStatements2WordMaster.docx' contains the 'Master Source Word File' which is equivalent to Sheet 'format' when creating pdf files.
    The file should be 'Read Only' to prevent the file from being modified by accident.
    c. The file contains 'Pseudo Mail Merge' sentinels (e.g. '<G5>'), where 'G5' indicates an Excel Cell Address.

    Enjoy.

    Lewis
    Last edited by LJMetzger; 01-01-2018 at 05:39 PM.

  12. #12
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Its an awesome work.Thanx a lot.You indeed gave a flexible choice to use.

    Lastly, in data could you use Ref.No. in which there are checkbox assigned.And just to pull the data in output/result part just left hand side of date or opposite to date

  13. #13
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,399

    Re: Print selected worksheets in pdf at selected destination

    The thread is marked as solved - are you still hoping for more help?
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  14. #14
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Yeah it is already.I know.If possible,plz see 2nd statement request.

  15. #15
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,399

    Re: Print selected worksheets in pdf at selected destination

    I've removed the solved tag to draw attention to it again.

  16. #16
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Print selected worksheets in pdf at selected destination

    I'm glad you liked what I did. It was a challenge but fun to work on.

    Lastly, in data could you use Ref.No. in which there are checkbox assigned.And just to pull the data in output/result part just left hand side of date or opposite to date
    See the attached Excel file and new 'Word Master File'. I put the 'Ref No' in Cell 'A6' on the 'Destination Sheet'.

    I don't know where the reference number comes from so I used the 'Row Number'. We can't currently use Column 'A' on Sheet 'format', because there is a 'TRUE' or 'FALSE' value currently in those cells (underneath each CheckBox) to indicate whether the CheckBox for that row is checked.

    You should be able to change the Ref. No. to anything you want, by modifiying the line in red below on line 529 of code module ModMain:
    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    No,It is already solved.Hence,initial forum contributor will just reply and it is not compulsory for last queries raised to be solved.Hence,I a have marked it solved again which you have done unsolved.

    Thankx for your kind concern too.

  18. #18
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,399

    Re: Print selected worksheets in pdf at selected destination

    My point is that the initial forum contributor will not necessarily review the thread once it is marked as solved, so if you are asking further questions, it's best to leave it until those issues are addressed. Anyway, you now have your answer.

  19. #19
    Forum Contributor
    Join Date
    03-11-2011
    Location
    Nepal
    MS-Off Ver
    MS Excel 2021 / 365
    Posts
    1,248

    Re: Print selected worksheets in pdf at selected destination

    Quote Originally Posted by LJMetzger View Post
    I'm glad you liked what I did. It was a challenge but fun to work on.



    See the attached Excel file and new 'Word Master File'. I put the 'Ref No' in Cell 'A6' on the 'Destination Sheet'.

    I don't know where the reference number comes from so I used the 'Row Number'. We can't currently use Column 'A' on Sheet 'format', because there is a 'TRUE' or 'FALSE' value currently in those cells (underneath each CheckBox) to indicate whether the CheckBox for that row is checked.

    You should be able to change the Ref. No. to anything you want, by modifiying the line in red below on line 529 of code module ModMain:
    Please Login or Register  to view this content.
    Thanx for kind help.

+ 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. Remove blank rows and print only selected worksheets
    By MARD99 in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 07-29-2017, 01:52 AM
  2. Printing Selected Pages from Multiple Worksheets into One Print Job
    By KivanAtaris in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-16-2013, 03:20 PM
  3. Replies: 2
    Last Post: 12-26-2012, 05:02 AM
  4. Print multiple selected worksheets to separate PDF's
    By Samantha McNeill in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-11-2010, 07:38 PM
  5. How do I print out selected worksheets one after the other
    By Greeneyes 22 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-26-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