Jonathon Carr
October 17th, 2001, 01:31 AM
The following code creates a text file in the directory that I specify.
Dim dateiname As String, dateinr As Integer
DirPath = "C:\text\"
dateiname = DirPath & textbox1.Text & ".txt"
'Check if path exists and create
If Dir$(DirPath & "\.") = "" Then
MkDir (DirPath)
End If
'go on writing the file
dateinr = FreeFile
Open dateiname For Output As dateinr
Print #dateinr, textbox2.Text
Close dateinr
'eyerything done
MsgBox "File saved to " & dateiname
End Sub
How would I get it to save the file to each separate folder within a
directory? For instance say you had the directory C:\text\ and within that
their were the folders text1, text2 and text3. How would I get the text file
to be saved into each one? Remembering that the app wont know what folders
are in the directory, so it will need to find out somehow.
Thanks,
Jonathon.
Dim dateiname As String, dateinr As Integer
DirPath = "C:\text\"
dateiname = DirPath & textbox1.Text & ".txt"
'Check if path exists and create
If Dir$(DirPath & "\.") = "" Then
MkDir (DirPath)
End If
'go on writing the file
dateinr = FreeFile
Open dateiname For Output As dateinr
Print #dateinr, textbox2.Text
Close dateinr
'eyerything done
MsgBox "File saved to " & dateiname
End Sub
How would I get it to save the file to each separate folder within a
directory? For instance say you had the directory C:\text\ and within that
their were the folders text1, text2 and text3. How would I get the text file
to be saved into each one? Remembering that the app wont know what folders
are in the directory, so it will need to find out somehow.
Thanks,
Jonathon.