Results 1 to 3 of 3

Thread: PDF Creator Code - Making Filename match a cell

  1. #1

    PDF Creator Code - Making Filename match a cell



    Register for a FREE account, and/
    or Log in to avoid these ads!

    Hi

    I'm trying to automate the printing of PDF's and after going round in circles with acrobat solutions, I the PDF creator code here and it worked great until I changed a variable and it's now getting stuck in a loop

    Originally the code was something like
    Code:
    '/// Change the output file name here! /// 
    sPDFName = "example.pdf" 
    sPDFPath = ActiveWorkbook.Path & Application.PathSeparator
    Which I've changed to:

    Code:
    '/// Change the output file name here! /// 
    sPDFName = Sheets("Invoicer").Range("D5") 
    sPDFPath = ActiveWorkbook.Path & Application.PathSeparator & "Invoices/"
    Which works, the pdf is printed in the right directory and with the right name, however it now gets stuck here

    Code:
    'Wait until the file shows up before closing PDF Creator 
    Do 
    DoEvents Loop Until Dir(sPDFPath & sPDFName) = sPDFName
    And it's a little beyond my skills as to why (it's probably very simple).
    If anyone could help I'd really appreciate it.

    Thanks

    Jon
    Last edited by jonrouston; 2012-05-25 at 05:37 PM.

  2. #2
    Jon,

    See if this is what you might be trying to do. For this to work correctly make you a folder C:\Invoices
    When you run the macro it will save the pdf into C:\Invoices

    This should give you a good idea of how the code works so you can adjust it to fit your situation.
    Attached Files Attached Files

  3. #3
    Quote Originally Posted by tommyt61 View Post
    Jon,See if this is what you might be trying to do. For this to work correctly make you a folder C:\InvoicesWhen you run the macro it will save the pdf into C:\InvoicesThis should give you a good idea of how the code works so you can adjust it to fit your situation.
    Works perfectly thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •