Print.Copies / Default Print Problem

I found this code on the Internet and I got everything to work but when I goto Print it will print to the default printer only and only do one copy, i cant find out where in the code to setup for multi copies and to tell it what printer to goto? Here is parts of the code.
thaburnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
>I found this code on the Internet
Define 'this code', preferably by copy-pasting it into the question.
0
thaburnerAuthor Commented:

Global Const SRCCOPY = &HCC0020
Global Const BI_RGB = 0
Global Const DIB_RGB_COLORS = 0
Global Const GMEM_MOVEABLE = 2

' Module level variables set in PrintStartDoc flag indicating Printing
' or Previewing:
Global PrinterFlag
' Object used for Print Preview:
Global ObjPrint As Control
' Storage for output objects original scale mode:
Global sm
' The size ratio between the actual page and the print preview object:
Global Ratio
' Size of the non-printable area on printer:
Global LRGap
Global TBGap
' The actual paper size (8.5 x 11 normally):
Global PgWidth
Global PgHeight

Sub PrintStartDoc(objToPrintOn As Control, PF, PaperWidth, PaperHeight)
   Dim psm
   Dim fsm
   Dim HeightRatio
   Dim WidthRatio

   ' Set the flag that determines whether printing or previewing:
   PrinterFlag = PF

   ' Set the physical page size:
   PgWidth = PaperWidth
   PgHeight = PaperHeight

   ' Find the size of the non-printable area on the printer to
   ' use to offset coordinates. These formulas assume the
   ' non-printable area is centered on the page:
   psm = Printer.ScaleMode
   Printer.ScaleMode = 5 'Inches
   LRGap = (PgWidth - Printer.ScaleWidth) / 2
   TBGap = (PgHeight - Printer.ScaleHeight) / 2
   Printer.ScaleMode = psm
   
   ' Initialize printer or preview object:
   If PrinterFlag Then
      sm = Printer.ScaleMode
      Printer.ScaleMode = 5 'Inches
      Printer.Print "";
   Else
      ' Set the object used for preview:
      Set ObjPrint = objToPrintOn
      ' Scale Object to Printer's printable area in Inches:
      sm = ObjPrint.ScaleMode
      ObjPrint.ScaleMode = 5 'Inches
      ' Compare the height and with ratios to determine the
      ' Ratio to use and how to size the picture box:
      HeightRatio = ObjPrint.ScaleHeight / PgHeight
      WidthRatio = ObjPrint.ScaleWidth / PgWidth
      If HeightRatio < WidthRatio Then
         Ratio = HeightRatio
         ' Re-size picture box - this does not work on a form:
         fsm = ObjPrint.Parent.ScaleMode
         ObjPrint.Parent.ScaleMode = 5 'Inches
         ObjPrint.Width = PgWidth * Ratio
         ObjPrint.Parent.ScaleMode = fsm
      Else
         Ratio = WidthRatio
         ' Re-size picture box - this does not work on a form:
         fsm = ObjPrint.Parent.ScaleMode
         ObjPrint.Parent.ScaleMode = 5 'Inches
         ObjPrint.Height = PgHeight * Ratio
         ObjPrint.Parent.ScaleMode = fsm
      End If
      ' Set default properties of picture box to match printer
      ' There are many that you could add here:
      ObjPrint.Scale (0, 0)-(PgWidth, PgHeight)
      ObjPrint.FontName = Printer.FontName
      ObjPrint.FontSize = Printer.FontSize * Ratio
      ObjPrint.ForeColor = Printer.ForeColor
      ObjPrint.Cls
   End If
End Sub

Sub PrintPrint(PrintVar)
'On Error Resume Next
   If PrinterFlag Then
      Printer.Print PrintVar
   Else
      ObjPrint.Print PrintVar
   End If
End Sub

Sub PrintNewPage()
   If PrinterFlag Then
      Printer.NewPage
   Else
      ObjPrint.Cls
   End If
End Sub

' Enter the following two lines as one, single line:
Sub PrintPicture(picSource As Control, ByVal pLeft, ByVal pTop, _
   ByVal pWidth, ByVal pHeight)

   ' Picture Box should have autoredraw = False, ScaleMode = Pixel
   ' Also can have visible=false, Autosize = true

   Dim BitmapInfo As BITMAPINFO_TYPE
   Dim DesthDC As Long
   Dim hMem As Long
   Dim lpBits As Long
   Dim r As Long

   ' Precaution:
   If pLeft < LRGap Or pTop < TBGap Then Exit Sub
   If pWidth < 0 Or pHeight < 0 Then Exit Sub
   If pWidth + pLeft > PgWidth - LRGap Then Exit Sub
   If pHeight + pTop > PgHeight - TBGap Then Exit Sub
   picSource.ScaleMode = 3 'Pixels
   picSource.AutoRedraw = False
   picSource.Visible = False
   picSource.AutoSize = True

   If PrinterFlag Then
      Printer.ScaleMode = 3 'Pixels
      ' Calculate size in pixels:
      pLeft = ((pLeft - LRGap) * 1440) / Printer.TwipsPerPixelX
      pTop = ((pTop - TBGap) * 1440) / Printer.TwipsPerPixelY
      pWidth = (pWidth * 1440) / Printer.TwipsPerPixelX
      pHeight = (pHeight * 1440) / Printer.TwipsPerPixelY
      Printer.Print "";
      DesthDC = Printer.hDC
   Else
      ObjPrint.Scale
      ObjPrint.ScaleMode = 3 'Pixels
      ' Calculate size in pixels:
      pLeft = ((pLeft * 1440) / Screen.TwipsPerPixelX) * Ratio
      pTop = ((pTop * 1440) / Screen.TwipsPerPixelY) * Ratio
      pWidth = ((pWidth * 1440) / Screen.TwipsPerPixelX) * Ratio
      pHeight = ((pHeight * 1440) / Screen.TwipsPerPixelY) * Ratio
      DesthDC = ObjPrint.hDC
   End If

   BitmapInfo.BitmapInfoHeader.biSize = 40
   BitmapInfo.BitmapInfoHeader.biWidth = picSource.ScaleWidth
   BitmapInfo.BitmapInfoHeader.biHeight = picSource.ScaleHeight
   BitmapInfo.BitmapInfoHeader.biPlanes = 1
   BitmapInfo.BitmapInfoHeader.biBitCount = 8
   BitmapInfo.BitmapInfoHeader.biCompression = BI_RGB

   ' Enter the following two lines as one, single line:
   hMem = GlobalAlloc(GMEM_MOVEABLE, (CLng(picSource.ScaleWidth + 3) \ 4) * 4 * picSource.ScaleHeight) 'DWORD ALIGNED
   lpBits = GlobalLock(hMem)

   ' Enter the following two lines as one, single line:
   r = GetDIBits(picSource.hDC, picSource.Image, 0, picSource.ScaleHeight, lpBits, BitmapInfo, DIB_RGB_COLORS)
   If r <> 0 Then
      ' Enter the following two lines as one, single line:
      r = StretchDIBits(DesthDC, pLeft, pTop, pWidth, pHeight, 0, 0, _
         picSource.ScaleWidth, picSource.ScaleHeight, lpBits, _
         BitmapInfo, DIB_RGB_COLORS, SRCCOPY)
   End If

   r = GlobalUnlock(hMem)
   r = GlobalFree(hMem)

   If PrinterFlag Then
      Printer.ScaleMode = 5 'Inches
   Else
      ObjPrint.ScaleMode = 5 'Inches
      ObjPrint.Scale (0, 0)-(PgWidth, PgHeight)
   End If
End Sub

Sub PrintEndDoc()
   If PrinterFlag Then
      Printer.EndDoc
      Printer.ScaleMode = sm
   Else
      ObjPrint.ScaleMode = sm
   End If
End Sub
0
thaburnerAuthor Commented:
lol didnt give me enough time to paste it
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

ptan218Commented:
Maybe you can modify the code. Change the following function from

Sub PrintStartDoc(objToPrintOn As Control, PF, PaperWidth, PaperHeight)

to

Sub PrintStartDoc(objToPrintOn As Control, PF, PaperWidth, PaperHeight, Copies)

Then

Add the following code at the beginning of the section:

Sub PrintStartDoc(objToPrintOn As Control, PF, PaperWidth, PaperHeight)
   Dim psm
   Dim fsm
   Dim HeightRatio
   Dim WidthRatio

   ' Set the flag that determines whether printing or previewing:
   PrinterFlag = PF

   ' Set the physical page size:
   PgWidth = PaperWidth
   PgHeight = PaperHeight
   Printer.Copies = Copies              <---------------------------- ADD HERE
   ' Find the size of the non-printable area on the printer to
   ' use to offset coordinates. These formulas assume the
   ' non-printable area is centered on the page:
   psm = Printer.ScaleMode




0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
thaburnerAuthor Commented:
that works great only other question i have it where does it print to the default printer, i need to have the user be able to select which printer for it to be directed to.
0
thaburnerAuthor Commented:
nm i figured it out have to do printer.devicename thanks alot for the help ptan
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.