Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing from a ListBox

Status
Not open for further replies.

sexydog

Programmer
Jul 9, 2002
176
0
0
GB
Hi

How do i print from a listbox to the printer and to a text file.

if you could tell me how to do either one that would be nice

thanks
 

to send to printer, use this
'======================================
For i = 0 To List1.ListCount
Printer.Print List1.List(i)
Next
'======================================

for file, use the filesystem object or the conventional open and print statement

All the Best
Praveen Menon
 
or

For i = 0 To List1.ListCount -1
Printer.Print List1.List(i)
Next
Printer.endDoc

®od
 
To print in file, use this

'======================================================
dim fn as string

'assign fn the filepath (app.path or something)

Open fn & "\BillConcise.txt" For Append As #1

For i = 0 To List1.ListCount
Print #1, slno + 1 & " )" & " NAME " & Name & vbTab, vbTab, vbTab, sysN
Print #1, vbTab, "INTIME " & intime
Print #1, vbTab, "OUTTIME " & outtime
Print #1, vbTab, "DURATION " & List1.List(0)
Print #1,
Print #1, vbTab, "CHARGE" & vbTab, Browse
Next

Close #1

'======================================================

All the Best
Praveen Menon
pcmin@rediffmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top