+ Reply to Thread
Results 1 to 11 of 11

Save 1 workbook with individual sheets & formats.

  1. #1
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Save 1 workbook with individual sheets & formats.

    Hello,

    I am seeking an help for a vba Macros script which can save a particular worksheet as .xls & pdf format from the same workbook. Below is the explanation.

    I have download a sample file from the internet which have the following below option and are working fine:-
    - Print preview the selected sheet.
    - Print the selected sheet.
    - Quit when click on Exit button.

    Now I have added 2 buttons on the same form which have to do the following:-

    - The selected sheet should Save as .PDF when I press Save as PDF button in the same place with below mentioned format. If the selected sheet is blank the it should give message “Cannot save sheet as PDF because the sheet is blank”.
    - The selected sheet should save as .xls when I press Save as Excel button in the same place. If the selected sheet is blank the it should give message “Cannot save sheet as excel because the sheet is blank”.

    NOTE: I AM USING EXCEL 2010 AND OTHER USERS USING EXEL 2007. SO IF POSSIBLE SAVE AS PDF CAN BE WORK FOR ALL THE VERSIONS I WILL BE VERY THANKFUL TO YOU.

    The format should be save as below mentioned format.

    Example: 1000 NRP Excelforum.com

    Where as:-
    1000 - Is the value of NRP sheet E23
    NRP - Is the selected sheet name
    Excelforum.com - Is the value of NRP sheet A23

    I hope the above mentioned details are the clear explanation to help me and this is the last assignment. I have attached sample file for more clarification.
    Attached Files Attached Files
    Last edited by hecgroups; 05-20-2012 at 10:51 AM.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Save 1 workbook with individual sheets & formats.

    hi there, please check attachment, the file was tested in Excel 2010
    Attached Files Attached Files

  3. #3
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    Thanks watersev for the script. But i ahve one issue with the attachment.

    When i select NRP sheet and press save as excel then it is saving the active sheet but the selected sheet.

    Once again i will repeat my request which i was requested above.

    When i select a sheet from the list dispalyed in lsit box and press any button i.e. Save as PDF or Save as excel then it should save the selected sheet same place.

    I hope you understand what i want.

    Can we solve this issue please.

  4. #4
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Save 1 workbook with individual sheets & formats.

    please check attachment
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    Thanks for your reply but there is another issue excel is working but same issue for pdf.

    I have selected NRP sheet but is is saving active sheet with the nrp name.

    what i means to say is, it is taking the name of selected sheet from the list but savng the active sheet. Could you please check the both options i.e. saving PDF and excel please.

    Thanks for your time.

  6. #6
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Save 1 workbook with individual sheets & formats.

    yes, sorry, I did not correct that in PDF code
    Attached Files Attached Files

  7. #7
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    Thanks a lot watersev. I works ofcourse it will work for original but i don't want to take any changes. I will get back to you tomarrow.

    I am always thankful to you and for your valuable helpful script.

  8. #8
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    I have last and final request.

    Sorry about this request because last night i remember that i have 2 languages of quotation. As a backup plan if my boss ask me to put this option as direct i.e. if a user generate the quotation then it should save as PDF or XLS then again i have to reffer this issue back to you.Can it be possible to have a script to save perticular sheet as xls. or pdf.

    What i want here is i want to save a perticular sheet as PDF or XLs. So, please write a 2 scripts i.e. One is for PDF and another for XLS. So, that i can get a idea and i can change the script as per necessity.

    For example i want to save quotation sheet as pdf or excel by clicking on button. NOT THE ACTIVE SHEET.

    I hope you understand.

    For more clarification please see the attachment.

    SAVE perticular sheet as XLS & PDF.xls

  9. #9
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Save 1 workbook with individual sheets & formats.

    I hope I understood you correct
    Attached Files Attached Files

  10. #10
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    You make my complicated request so easy. You are really genius. No words speak.

    Thanks for your help. your script will save my daily heavy workload hours.

    God bless you.

  11. #11
    Valued Forum Contributor
    Join Date
    01-11-2012
    Location
    Riyadh, K.S.A.
    MS-Off Ver
    Windows 11 with Excel 2013 & 2016
    Posts
    905

    Re: Save 1 workbook with individual sheets & formats.

    Thanks it works reputation will be added soon and topic marked as solved.

+ 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