I'm trying to print the contents of a listbox, but not getting them to print side by side. Also, it won't print until the application has been closed?? Any help would be greatly apprecited. Here's the code:
VB Code:
'*CMDPRINT_CLICK()************************************************************* 'NAME: cmdPrint_Click() 'DESC: Prints the contents of the listbox (lstFirstScreen). Private Sub cmdPrint_Click() If (lstFirstScreen.ListCount > 0) Then Dim lngIndex As Long Dim count As Integer Dim strArray() As String Printer.FontSize = 11 'Printer.Print lstFirstScreen.List(0) & vbNewLine; Printer.Print "--------------------------------------------------------" _ & "----------------------------------------------------------------" _ & "----------------------------" For lngIndex = 0 To lstFirstScreen.ListCount - 1 'Printer.Print lstFirstScreen.List(lngIndex) & vbNewLine; strArray = Split(lstFirstScreen.List(lngIndex), vbTab, -1, 1) For count = LBound(strArray) To UBound(strArray) 'MsgBox (lngIndex & ": " & strArray(count)) Printer.Print strArray(count) Printer.Print vbTab Next Printer.Print vbNewLine Next Printer.EndDoc End If End Sub '*ENDOF*CMDPRINT_CLICK()*******************************************************




Reply With Quote