Advertisement

07.09.2008 at 06:34PM PDT, ID: 23552443
[x]
Attachment Details

In the range I select only prints the first PDF of the seleted rows

Asked by RUNProperty in Visual Basic Programming

I select an excel range, and try to print the PDF Documents
E.g
26/06/2008      RUN Property (NSW)      000000002730981      Body Corporate Cleaning ServiceTony And Marie Moubarak      Inv 83      89.31      98.24 I:\Docs\CY1000001RPMPROD\Documents\2008\06\25 000000001057034_20080625_121119_cleaning_invoice.pdf

26/06/2008      RUN Property (NSW)      000000002730981      Body Corporate Cleaning Service Firmack Pty Ltd      Inv 83      87.26      95.99      I:\Docs\CY1000001\RPMPROD\Documents\2008\06\25\000000001057042_20080625_121939_cleaning_invoice.pdf

My Problem is it only prints the pdf in the first row, it doesnt print the pdf document from  the second row onwards.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Sub PrintPDFDocument()
Dim strDocument As String, strExecutable As String
    strPrinterName = Application.ActivePrinter
    strDriverName = GetPrinterDetails.DriverName
    strPortName = GetPrinterDetails.PortName
    strExecutable = GetExecutablePath("pdf") ' get the path to Acrobat Reader
    If Len(strExecutable) > 0 Then
        ' Set the current cell to A1
                   
        Range("I1").Activate
        ' Loop until we get to the end of the data
        Do While Not ActiveCell.Row = Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
            strDocument = ActiveCell.Cells.Value
            Shell strExecutable & " /p " & strDocument
            ' Can't seem to get the following bit of code to work for some reason
            ' Shell strExecutable & " /t " & strDocument & " " & strPrinterName & " " & strDriverName & " " & strPortName
            ActiveCell.Offset(1, 0).Range("I1").Select
            
        Loop
    End If
End Sub
 
Keywords: In the range I select only prints the first…
 
Loading Advertisement...
 
[+][-]07.11.2008 at 09:16AM PDT, ID: 21983705

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Visual Basic Programming
Sign Up Now!
Solution Provided By: TRobinJames
Participating Experts: 2
Solution Grade: A
 
 
[+][-]07.11.2008 at 04:42PM PDT, ID: 21986821

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.15.2008 at 06:26AM PDT, ID: 22006711

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.16.2008 at 04:25PM PDT, ID: 22021078

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
[+][-]07.20.2008 at 04:21AM PDT, ID: 22045306

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628