Does anyone know how to print contents of a ListBox control?
Please, help.
Thanks,
Olga
Printable View
Does anyone know how to print contents of a ListBox control?
Please, help.
Thanks,
Olga
Something along the lines of this should work for you:
Code:Dim I As Integer
For I = 0 To List1.ListCount - 1
Printer.Print List1.List(I)
Next
Printer.EndDoc
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
Thanks, Aaron!
Worked like a charm!
Olga.
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