Click to See Complete Forum and Search --> : printer help


Archie
April 18th, 2001, 01:12 PM
Using this code does anyone know what code I need to add so that the common dialog combo box appears so that I can select either "ok" or "cancel". Thank you.

Private Sub mnuPrint_Click()
Dim Item As Integer
Dim ErrHndlr As Integer
On Error GoTo ErrHndlr
cdlOne.CancelError = True
cdlOne.ShowPrinter
On Error GoTo 0

' Prints the contents of the lstShopping list box.

For Item = 0 To lstShopping.ListCount - 1
Printer.Print lstShopping.List(Item)
Next
Printer.EndDoc
Exit Sub
ErrHndlr:

End Sub


Archie Kantzavelos

Iouri
April 18th, 2001, 01:53 PM
I just tried it it works

Private Sub Command1_Click()
On Error Resume Next
List1.AddItem "c:\zip\junk.txt" ' or set the .Text property to some string value
List1.ListIndex = 0

With CommonDialog1
.CancelError = True
.Flags = cdlPDReturnDC + cdlPDHidePrintToFile + cdlPDNoPageNums + cdlPDNoSelection + cdlPDNoWarning
.ShowPrinter
End With
If (Err.Number <> cdlCancel) Then
Printer.Print List1.Text
Printer.EndDoc
End If
On Error GoTo 0
End Sub

I did not do Loop for this test

Iouri Boutchkine
iouri@hotsheet.com