Printing code slowing down printing reports (1 Viewer)

Chrisopia

Registered User.
Local time
Yesterday, 17:39
Joined
Jul 18, 2008
Messages
279
I was having trouble just setting each report with a particular print method - for some reason they just kept forgetting their individual settings and resorting to default on the machine.
This meant reports were printing on the wrong paper, or the wrong size paper, the wrong orientation and some times refusing to print if it couldn't find the paper (which is useful in runtime as it doesn't display error messages)

So I used Reports(rpt).printer properties (forgive me, I forgot where I found this) to hard code the printer properties into each print command... this meant I had to use another function to insert the variables.

So all I had to do was say:
Code:
PrintMe("Invoice","InvoiceID",iID)
and a report would print to exactly how I wanted... but it's just too slow!

See attached for full code, I have a niggling feeling it may be the function: PrinterOK, to make sure the printer exists or not.

Code:
Function PrinterOK(sPrinterName As String) As Boolean
Dim MyPrinter As Printer

PrinterOK = False

For Each MyPrinter In Printers
    If MyPrinter.DeviceName = sPrinterName Then
        PrinterOK = True
        Exit Function
    End If
Next
End Function

I know it's the printing code, because if I stop the printing and just preview then it shows up almost instantly.
 

Attachments

  • printing vba.txt
    2.5 KB · Views: 77

spikepl

Eledittingent Beliped
Local time
Today, 02:39
Joined
Nov 3, 2010
Messages
6,142
You are most likely right. Insert

debug.print Now() before and after and then in the immediate window see the output and determine how much time it took
 

Users who are viewing this thread

Top Bottom