Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printing batch files in Excel with pdfp

    Hello everyone!
    So i have this problem, i have excel spreadsheet where i made a couple of data validation lists (gets list of pdf files from spreadsheet2) in which user selects .pdf file and clicks "print" button to send it to printer. Now i want to print those files in batches (1-10 copies) , i have empty cells where number of needed copies are saved and from there i would like for excel to get them and send needed copies to printer i found out i can do that with pdfp script ( http://www.softsea.com/review/PDFp.html ) but i don't know how to implement that into my code.

    Code:
    Sub PrintPDFfiles(l As Long)
    
    Call Shell("""C:\Program Files (x86)\Adobe\Reader 10.0\Reader\AcroRd32.exe"" " & "/n /h /t" & " ""c:\files\List\" & Cells(l, 2).Text & """ """ & strPrinter & """")
    Range("B" & Rows.Count).End(xlUp).Select
    
    End Sub
    
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Not Intersect(Target, Range("K7:K29")) Is Nothing Then
        If Right(Cells(Target.Row, 2).Text, 4) = ".pdf" Then
            Call PrintPDFfiles(Target.Row)
        Else
            MsgBox "Nothing is selected"
        End If
    End If
    
    End Sub
    So does anyone know how i could achieve this ?

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,162
    Thanks
    14
    Thanked 317 Times in 311 Posts
    I am not sure why you need to use that particular program and unsure how VBA would access it. If you just want to print, why not just print it multiple times with a loop?

    Also perhaps the code at http://windowssecrets.com/forums/sho...om-Excel-Sheet could help...

    Steve

  4. #3
    New Lounger
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yeah i have tried exactly that code and it only prints 1 file, what i want is that program/macro would print multiple files from some cell named "countcell". I don't know how to do that so i found some script that should enable that somehow (pdfp.c)

  5. #4
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,162
    Thanks
    14
    Thanked 317 Times in 311 Posts
    As I mentioned earlier, how about a loop...

    Code:
    For x = 1 to range("countcell")
    Call PrintPDFfiles(Target.Row)
    Next x
    Steve

  6. #5
    New Lounger
    Join Date
    May 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I did not think of that! thanks for this, i will try it as soon as i get on home computer, thanks again for help! i will post if code works.

Posting Permissions

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