-
I need to print the contain of a list box into 6 colunms.
EX:
listbox1.list =
xxxxxx-xxx
xxxxxx-xxx
xxxxxx-xxx
. . .
I want that comes out the printer
xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx
xxxxxx-xxx xxxxxx-xxx xxxxx-xxx xxxxxx-xxx xxxxxx-xxx
Please Help!
-
<?>
Have to go to work..just change this to read your
list
Option Explicit
Private Sub Command1_Click()
Dim i, j, k
j = 1
i = "XXXX_ xx"
For k = 1 To 18
If j < 6 Then
Printer.Print i,
Else
Printer.Print i:
If j = 6 Then j = 0
End If
j = j + 1
Next k
Printer.EndDoc
End Sub
'will check at work to see if you need further help
-
Somekind of solution...
Well, you could print first the listbox contents into a string and print it then.
Code:
'just add into any control
Dim A As Integer
Dim B As Integer
Dim Text As String
Text = ""
Do While A < List1.ListCount
B = B + 1
If B > 6 Then B = 1: Text = Text & vbNewLine
Text = Text & " " & List1.List(A)
A = A + 1
Loop
Printer.Print Text
Printer.EndDoc
Hope this helps,
[Edited by MerryVIP on 11-01-2000 at 08:27 AM]
-
Do this:
Code:
Private Sub cmdPrint_Click()
Dim tmp As String
For i = 0 To List1.ListCount - 1
tmp = tmp & List1.List(i) & vbNewLine
Next i
Printer.Print tmp
Printer.EndDoc
End Sub
Any help?
-
Wait a second...
Did you want it to come this way:
xxxxxx-xx
xxxxxx-xx
or:
xxxxxx-xx xxxxx-x
If you chose the first option see my previous post.
If you choose the second do this:
Code:
Private Sub cmdPrint_Click()
Dim tmp As String
For i = 0 To List.ListCount - 1
tmp = tmp & List1.List(i) & " "
Next i
Printer.Print tmp
Printer.EndDoc
End Sub
Did this help now?
-
He meant, they come six in a line!
xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 1
xxxx xxxx xxxx xxxx xxxx xxxx <- End of line 2
etc.
My code does this perfectly...So I wonder why you add something that isn't really answer to the question.
Sorry :)
-
<?>
MerryVip:
Don't be too harse on other people's answeres; sometimes, they don't quite see it as you or someone else does. Your code is the same as the quick fix I transcribed except that it is expressed by yourself as printing the listbox.
I was running late for work so I merely expressed it as the formula for doing what was required.
:D
It doesn't matter what other's post, as long as the questioner can find the answer in the postings, that is all that counts.
-
I know that and that was the "Sorry :)" for ;)
But please, people really should read other people posts well before answering...I don't answer when I'm not quite sure what somebody's meaning,I don't know answer or somebody have answered to the question correctly before me.
Anyway, we should start a new post that blames me if you want to continue :)
Though, I've to go now. Online next time tomorrow...