Quote:
> i would like to know if i can save a list box to a file...it would be
multi
> line...thanks
> simon wilkinson
This is an easy way to save the content of a listbox to a file:
Sub SaveListboxToFile(lstbox As Listbox, filename As String)
Dim I As Integer
Dim fNum As Integer
If lstbox.ListCount = 0 Then Exit Sub
fNum = FreeFile
Open filename For Output As #fNum
For I = 0 To lstbox.ListCount - 1
Print #fNum, lstbox.List(I)
Next I
Close #fNum
End Sub
Usage:
SaveListboxToFile List1, "C:\directory\filename.lst"
SaveListboxToFile List1, "D:\VBProject\savedfiles\ListBox.txt"
Remember that this sub doesn't have any errorhandler so try to type the
correct filename or else a runtime error will popup.
Jan Magne Tjensvold