Results 1 to 8 of 8

Thread: Close PDF Complete Viewer

  1. #1

    Close PDF Complete Viewer



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

    I have created a VBA to print pdfs for names from a drop down list and save it based on a cell value. I have everything working. Currently must close the PDF viewer in order for the next drop down item to print correctly. I have 300 names in the drop down and instead of closing the viewer I am now trying to find a way to close my PDF viewer automatically in the code. I have tried several ways, but can't seem to get it to work. Any guidance would be greatly appreciated. Here is what I have currently.

    Code:
    Sub SavePDF()
    '
    ' SavePDF Macro
    ' Macro recorded 7/09/13
    '
    '
    Dim n As Integer
    With Worksheets("Capital Summary")
        Sheets("Capital Summary").Select
        Range("B2:K43").Select
        ActiveSheet.PageSetup.PrintArea = "$B$2:$K$43"
        'loop through names for drop-down
        For n = 0 To Range("M8").Value
            'drop down in E4 and first name in list in Q6
            'change as required.
            'apply each name to drop-down cell
            .Range("E4") = .Range("Q6").Offset(n, 0).Value
            'print each record (uses current printer)
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, ActivePrinter:="PDF Complete"
    newHour = Hour(Now())
    newMinute = Minute(Now())
    newSecond = Second(Now()) + 5
    waitTime = TimeSerial(newHour, newMinute, newSecond)
    Application.Wait waitTime
    Filename = ActiveWorkbook.Path & Application.PathSeparator & ActiveSheet.Range("M7").Value
    SendKeys Filename & "{ENTER}", False
    Application.Wait waitTime
    OpenAfterPublish = False
        Next n
    End With
    End Sub

  2. #2
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,284
    Articles
    57
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    I don't know anything about PDF Complete, as I've never dealt with that one before.

    I'm curious... your code looks like it is sending to the printer, and then you're trying to use SendKeys to click OK on the commands that pop up when the PDF software opens. Is that right?

    If that's the case, I would HIGHLY recommend that you switch your PDF creation software to one that has an actual VBA library to code against. Personally, I use PDFCreator, which is a free PDF Writer from SourceForge, and I've got a bunch of examples of routines here to work with it. Not sure if your'e interested in switching out, but I don't have issues with PDFCreator binding up or opening Adobe.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  3. #3
    Yes, that is correct. I am trying to use SendKeys to copy and paste the value of a cell as the file name and then hit enter to save it. I was reviewing your codes the last few days, but I was not able to get it to work with what I am trying to do. Sorry, I am new to the VBA code writing. I downloaded PDFComplete and tried using the my code with PDFComplete as the printer, but now the SendKeys is not pasting the file name or saving it. Any suggestions?

  4. #4
    Administrator Ken Puls's Avatar
    Join Date
    Mar 2011
    Location
    Nanaimo, BC, Canada
    Posts
    2,284
    Articles
    57
    Blog Entries
    14
    Excel Version
    Excel Office 365 Insider
    Honestly, if you're new to this, you have the ability to install your software, and you haven't used PDF Complete much either, I'd uninstall PDF Complete, install PDFCreator (the link is in the article), and get us to help you build a solution using PDFCreator. You'll find it WAY more stable than trying to use SendKeys. (Also, FYI, the code base for PDFCreator is specific to that program, so it won't work with anything else.)

    If you're game for that, tell us what you're trying to accomplish? Create multiple PDF's at once? Create a single PDF from multiple sheets? What's the scenario that drives things? I'm certain we can do it with PDFCreator.
    Ken Puls, FCPA, FCMA, MS MVP

    Learn to Master Your Data at the Power Query Academy (the world's most comprehensive online Power Query training), with my book M is for Data Monkey, or our new Power Query Recipe cards!

    Main Site: http://www.excelguru.ca -||- Blog: http://www.excelguru.ca/blog -||- Forums: http://www.excelguru.ca/forums
    Check out the Excelguru Facebook Fan Page -||- Follow Me on Twitter

    If you've been given VBA code (a macro) for your solution, but don't know where to put it, CLICK HERE.

  5. #5

    PDF forms

    I discovered a site where there are searchable and fillable pdf forms.

  6. #6
    You might be interested as well because I was able to search for forms and fill it out.

  7. #7
    PDF complete? There is another one I discovered and I think it is much better.

  8. #8
    Sorry If i keep on posting it is not allowing me to show you the link that you can follow.

Posting Permissions

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