+ Reply to Thread
Results 1 to 9 of 9

separate the sheet and save in PDF

  1. #1
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    separate the sheet and save in PDF

    dear all

    i have doc with 50 pages letter in one, i want to separate all pages and want to save in PDF each file individually path: C:\Users\adeel\Desktop\PDF

    and file name should be company name which is top on each sheet..!

    Adeel
    Attached Files Attached Files
    Last edited by adeel1; 02-23-2017 at 04:40 AM.

  2. #2
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: separate the sheet and save in PDF

    Hi
    for as long as every company name is preceded by "To," and a paragraph, this should work

    Please Login or Register  to view this content.

  3. #3
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: separate the sheet and save in PDF

    dear nick
    when i run the code showing error "this is not valid filename", pl look into

    Adeel
    Last edited by adeel1; 02-24-2017 at 04:40 AM.

  4. #4
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: separate the sheet and save in PDF

    Hi Adeel

    That's probably because the file name is not acceptable, or the directory is not properly specified.

    Is this the correct path for the directory to save the files into:

    C:\Users\adeel\Desktop\PDF\

    if so, did the macro copy some files into this directory, or did it hit the error on the first one?

  5. #5
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: separate the sheet and save in PDF

    Dear Nick
    lot of thanks, now its working, i just copy and pasted the code actually there was space in mention path...!!great work sir

    Adeel

  6. #6
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: separate the sheet and save in PDF

    Dear Nick

    just facing one problem that i added header and footer and make some changing in paragraph,after that code is not working showing error again that - Run time error'-2147467259 (800054005) "this is not valid filename"


    Adeel
    Attached Files Attached Files
    Last edited by adeel1; 02-24-2017 at 10:44 AM.

  7. #7
    Forum Expert
    Join Date
    06-09-2010
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    1,714

    Re: separate the sheet and save in PDF

    Hi

    There now appears to be a space after the “To, “ so the search and replace was not finding the company name. This is the most complex part of the macro and likely to be quite unstable, because it relies on finding the characters “To,” and selecting the text in the line below to identify the company name. If you have the companies’ names in a separate file – for example, a word table for a mail merge or an excel spreadsheet – it might be better to use this to identify the company names, not the letters themselves.

    Another weakness in this format is that it assumes each page contains a single separate letter. If any of your letters are more than a page, it will only export the first page.

    I have tweaked the macro to make it more stable. It is now ignoring the space after the “To, “. I have also modified it to print every page, regardless of the document length, and to check for illegal file names.

    Several of your company names include characters that cannot be used in a file name, most commonly “ / “. When it encounters one of these, the macro should now present you with an input box to enter a legitimate file name. I suggest you delete the “ / “ in this instance.


    Best wishes

    Nicky

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    08-04-2016
    Location
    pakistan
    MS-Off Ver
    2010
    Posts
    225

    Re: separate the sheet and save in PDF

    Dear Nick

    lot of thanks for help sir, this is great, absolutely great work
    really appreciate your knowledge skill and patience, thanks

    Adeel

  9. #9
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: separate the sheet and save in PDF

    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

+ 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. Replies: 0
    Last Post: 08-06-2015, 10:33 AM
  2. [SOLVED] Match Multiple Columns from Separate Sheet to get separate column.
    By gvitoro in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-19-2014, 03:38 PM
  3. [SOLVED] Save each row as a separate .xls file
    By janschepens in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-21-2012, 10:51 AM
  4. save a single sheet from a workbook as a separate file?
    By lottesfog in forum Excel General
    Replies: 5
    Last Post: 12-13-2007, 12:45 AM
  5. Save 2 separate data imports in separate worksheets on the same ex
    By Jay in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2006, 09:35 AM
  6. Select sheet tabs in workbook & save to separate workbook files
    By stratocaster in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2006, 11:40 AM
  7. [SOLVED] How do I save each sheet as a separate .xls file by using macro?
    By Min in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-18-2005, 10:06 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