Hi,i load a list box with the a list of names in,how could i save all those names one by one to diffrent txt files file thanks!
Printable View
Hi,i load a list box with the a list of names in,how could i save all those names one by one to diffrent txt files file thanks!
you want each name to a different file ?, if so try this.
casey.VB Code:
Dim i As Integer For i = 0 To List1.ListCount - 1 Open "C:\Name" & i + 1 & ".txt" For Output As #1 Print #1, List1.List(i) Close #1 DoEvents Next i
In case you want to save them in the same folder your application is:
VB Code:
Dim i As Long For i = 0 To List1.ListCount - 1 Open App.Path & "\" & List1.List(i) & ".txt" For Output As #1 Print #1, List1.List(i) Close #1 DoEvents Next
I just made some changes to vbasicgirl, I hope she doesn't mind.
If you want them all in just one file:
VB Code:
Dim i As Long Open App.Path & "\" & List1.Name & ".txt" For Output As #1 For i = 0 To List1.ListCount - 1 Print #1, List1.List(i) Next Close #1
I think he wanted different files.
yeh i want it to say every diff name to a diff txt files like there 5 names so there be 5 txt files cheers :P