Print a listbox? [Resolved]
When I try to print out this it dosen't look as straight and nice as it looks in the listbox. Why?
VB Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const LB_SETTABSTOPS = &H192
Private Sub Form_Load()
ReDim TabStop(0 To 2) As Long
'assign some values to the tabs for the second third and fourth
'column (the first is flush against the listbox edge)
TabStop(0) = 20
TabStop(1) = 70
TabStop(2) = 200
List1.Clear
'clear then set the tabs
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 0&, ByVal 0&)
Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 3, TabStop(0))
List1.AddItem "Test text" & Chr(9) & "Test Date 0301" & Chr(9) & "MaterialNumber"
List1.AddItem "Test text 2" & Chr(9) & "Test Date 030104" & Chr(9) & "MaterialNumber"
List1.AddItem "Test text 3" & Chr(9) & "Test Date 20030301" & Chr(9) & "MaterialNumber"
List1.AddItem "Test text 4" & Chr(9) & "Test Date Wednesday 04:00 Pm" & Chr(9) & "MaterialNumber"
End Sub
Private Sub Command1_Click()
Dim x As Integer
For x = 0 To List1.ListCount - 1
Printer.Print List1.List(x)
Next x
Printer.EndDoc
End Sub