Here's one way....
Needs a command button
'============== ===
Option Explicit
Private Sub Command1_Click( )
Const START_PATH = "C:\Temp\"
Dim sFullPath As String
Dim v As Variant
Dim i As Integer
Dim iFile As Integer
'Split the contents into an array
v = Split(Text1.Tex t, vbCrLf)
iFile = FreeFile
For i = 0 To UBound(v)
If Len(v(i)) > 0 Then
iFile = FreeFile
sFullPath = START_PATH & v(i)
Debug.Print "Creating " & sFullPath & " ...."
Open sFullPath For Output As iFile
Close iFile
End If
Next
Debug.Print "Done"
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text1.SelText = "13-02-00 - Paul Oakenfold.txt" & vbCrLf
Text1.SelText = "06-02-00 - William Orbit.txt" & vbCrLf
Text1.SelText = "30-01-00 - Laurent Garnier.txt" & vbCrLf
Text1.SelText = "23-01-00 - Guy Ornadel.txt" & vbCrLf
Text1.SelText = "16-01-00 - Dave Clarke.txt" & vbCrLf
Text1.SelText = "09-01-00 - Scott Bond.txt" & vbCrLf
Text1.SelText = "02-01-00 - Mr C.txt" & vbCrLf
End Sub
'============== ===
--
Ken Halter - MS-MVP-VB -
http://www.vbsight.com
Please keep it in the groups..
"Paul" <12************ **@btinternet.c om> wrote in message
news:bj******** **@sparta.btint ernet.com...
How would I convert the contents of a textbox into text files.
Say I have a textbox containin the following...
13-02-00 - Paul Oakenfold
06-02-00 - William Orbit
30-01-00 - Laurent Garnier
23-01-00 - Guy Ornadel
16-01-00 - Dave Clarke
09-01-00 - Scott Bond
02-01-00 - Mr C
I would like to loop thru the textbox and need each line to be saved as a
text file under that name. So I would end up with 7 blank text files e.g....
13-02-00 - Paul Oakenfold.txt
06-02-00 - William Orbit.txt
30-01-00 - Laurent Garnier.txt
23-01-00 - Guy Ornadel.txt
16-01-00 - Dave Clarke.txt
09-01-00 - Scott Bond.txt
02-01-00 - Mr C.txt
I've tried getting the contents of the textbox
Thanks....