PDA

Click to See Complete Forum and Search --> : Printing contents of a ListBox control


OlgaV
Nov 2nd, 1999, 10:01 PM
Does anyone know how to print contents of a ListBox control?
Please, help.

Thanks,

Olga

Aaron Young
Nov 2nd, 1999, 10:16 PM
Something along the lines of this should work for you:

Dim I As Integer
For I = 0 To List1.ListCount - 1
Printer.Print List1.List(I)
Next
Printer.EndDoc



------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

OlgaV
Nov 2nd, 1999, 10:24 PM
Thanks, Aaron!

Worked like a charm!

Olga.

cas21
Nov 2nd, 1999, 10:24 PM
Option Explicit
Dim i As Integer

Private Sub cmdPrint_Click()
For i = 0 To 9
List1.ListIndex = i
'Debug.Print List1 'Prints in the immediate window
Print List1 'Prints on the form
'Printer.Print List1 'Prints on my laser, Assume no more than one page
Next
Printer.EndDoc
End Sub

Private Sub Form_Load()
For i = 1 To 10
List1.AddItem (i)
Next
End Sub