+ Reply to Thread
Results 1 to 10 of 10

Print to PDF, Merge PDF

  1. #1
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Print to PDF, Merge PDF

    Hi guys I have a macro printing to pdf and then merging with another PDF. How can I save my DestFile to a different location than the folder where I grabbed the 2 PDF's to merge?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Print to PDF, Merge PDF

    Instead of the following line of code, set p to whatever location you want to save it to
    Please Login or Register  to view this content.
    For example
    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Print to PDF, Merge PDF

    Thx Jazz, I keep getting a Duplicate declaration in current scope comp error though?

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Print to PDF, Merge PDF

    Oh, that's because p is already declared. So you can use
    Please Login or Register  to view this content.
    There are a few odd techniques in this code. For example, MyPath is a Const but there is an If statement checking to see if it ends in a "\".

  5. #5
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Print to PDF, Merge PDF

    What do you suggest to clean up the code? I am just looking to combine 2 pdf's in one folder and save the combined PDF in another folder

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Print to PDF, Merge PDF

    It's not wrong, it's just a little unusual and I'm not sure why it was done. I assume you did not write all this yourself. Try the change I suggested and see if that gets you what you need.

  7. #7
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Print to PDF, Merge PDF

    Thanks again Jazz, still not working tho, i'm sure something is wrong with my two folder locations and MyPath:
    Please Login or Register  to view this content.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Print to PDF, Merge PDF

    Please explain what "not working" means.
    • Does the code run?
    • Does it run but do nothing?
    • Does it produce error messages? If so, what do the messages say?
    • Does it stop in the debugger? On what line of code?
    • Does it produce unexpected/wrong results?
    • Does it hang?

  9. #9
    Forum Contributor
    Join Date
    08-23-2013
    Location
    Alberta, Canada
    MS-Off Ver
    Excel 365
    Posts
    166

    Re: Print to PDF, Merge PDF

    The PDF print is working to the right location but I get a "File not found" for PDF2.pdf here:

    Please Login or Register  to view this content.

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2411
    Posts
    26,703

    Re: Print to PDF, Merge PDF

    You can't possibly get a File Not Found on that line of code. It's just a declaration with a string assignment. What line is highlighted in yellow when the error occurs?

+ 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. [SOLVED] vba to print mail merge results
    By excelloser in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-01-2012, 10:49 AM
  2. Replies: 2
    Last Post: 07-12-2012, 08:11 PM
  3. print merge
    By Pavczech in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-16-2011, 06:11 PM
  4. Print mail merge document
    By LisaPatch in forum Excel Programming / VBA / Macros
    Replies: 31
    Last Post: 10-31-2011, 09:54 AM
  5. Print merge from within excel
    By excel passion in forum Excel General
    Replies: 2
    Last Post: 05-26-2010, 12:43 AM
  6. [SOLVED] Print merge file
    By ShadowVixen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-11-2006, 04:15 PM
  7. [SOLVED] Envelopes will not print using mail merge.
    By mission in forum Excel General
    Replies: 1
    Last Post: 09-29-2005, 06:05 AM
  8. [SOLVED] Merge and print
    By Einar in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-16-2005, 06:05 AM

Tags for this Thread

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