Results 1 to 3 of 3

Thread: Common Dialog (Printer) Problem

  1. #1

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657

    Unhappy

    How do I setup the Printer Common Dialog control so that the user can vary the number of copies to print, but only for my app?

    Here's the history of the problem. Originally, my Common Dialog setup code looked like this:
    Code:
        With dlgPrint
            .CancelError = True
            .Flags = cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection
            .ShowPrinter
        End With
    With the above code, if the user changes the number of copies to 2, two copies of the report will print (the subsequent code prints a Crystal Report), which is fine. However, the default properties of the printer remain as the user set them in my app, so if they go into Word (or whatever other Windows app), two copies will print by default - NOT desirable.

    So then, I add the following line to my code:

    Code:
        With dlgPrint
            .PrinterDefault = False
            .CancelError = True
            .Flags = cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection
            .ShowPrinter
        End With
    Now, the user can still adjust the number of copies in the print dialog box, but it has NO EFFECT - only one copy (or whatever number of copies is set for the printer as a default) prints.

    What's the solution??? Thanks in advance for your help.


    "It's cold gin time again ..."

    Check out my website here.

  2. #2
    Member
    Join Date
    Nov 1999
    Location
    Perth, WA
    Posts
    35
    the printer has a command "copies". when you use commdlg.showprinter then set the number of copies it sets this flag.

    im only guessing as ive never done it myself but i would hazard a gues at something like:


    code
    -----------------
    commdlg.showprinter
    dim i as integer
    for i = 1 to printer.copies
    printer.line(69,69)(86,86)
    printer.enddoc
    next i

    -----------
    end code

    or something like that


  3. #3

    Thread Starter
    PowerPoster BruceG's Avatar
    Join Date
    May 2000
    Location
    New Jersey (USA)
    Posts
    2,657
    Thanks for responding, XMortal. While your example was not exactly what I was looking for, it did point me in the right direction. I was able to solve my problem by doing the following:
    Code:
    Dim intCopies As Integer
    
    With dlgPrint
            .PrinterDefault = False
            .CancelError = True
            .Flags = cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection
            .ShowPrinter
            intCopies = .Copies
        End With
    
    With rptCrysRep
        ... other CR setup stuff ...
        .CopiesToPrinter = intCopies
        .Action = 1
    End With
    Thanks again.
    "It's cold gin time again ..."

    Check out my website here.

Posting Permissions

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



Click Here to Expand Forum to Full Width