tota79
asked on
New, Open, Save ?
hi , Experts
i wana to know how to make a new file , open and save file?
i wana to know how to make a new file , open and save file?
ASKER
i have a texts box , how i save the results in that file
ASKER
i have a texts box , how i save the results in that file
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
O and anougther way might be
Public Function saveFile(lzFile As String, StrData As String)
Dim tFile As Long
tFile = FreeFile
Open lzFile For Binary Access Write As #tFile
Put #tFile, , StrData
Close #tFile
End Function
Public Function OpenFile(lzFile As String) As String
Dim tFile As Long
Dim StrBuff As String, FileToOpen As String
tFile = FreeFile
Open lzFile For Binary Access Read As #tFile
StrBuff = Space(LOF(tFile))
Get #tFile, , StrBuff
Close #tFile
OpenFile = StrBuff
StrBuff = ""
End Function
Private Sub Command1_Click()
' to open a file
Text1 = OpenFile("c:\test.txt")
' to save to a file
saveFile "C:\myfile", "this is some data saved to a file"
End Sub
hope it helps
Public Function saveFile(lzFile As String, StrData As String)
Dim tFile As Long
tFile = FreeFile
Open lzFile For Binary Access Write As #tFile
Put #tFile, , StrData
Close #tFile
End Function
Public Function OpenFile(lzFile As String) As String
Dim tFile As Long
Dim StrBuff As String, FileToOpen As String
tFile = FreeFile
Open lzFile For Binary Access Read As #tFile
StrBuff = Space(LOF(tFile))
Get #tFile, , StrBuff
Close #tFile
OpenFile = StrBuff
StrBuff = ""
End Function
Private Sub Command1_Click()
' to open a file
Text1 = OpenFile("c:\test.txt")
' to save to a file
saveFile "C:\myfile", "this is some data saved to a file"
End Sub
hope it helps
dim intFile as integer
dim strData as string
strFile = "C:\yourfile.txt"
'create a file
intFile = freefile
open strFile for output as #intFile
print #intfile, "yourdata"
close #intFile
'reading a file
intFile = freefile
open strFile for input as #intFile
while not eof(intFile)
line input #intFile, strData
wend
close #intFile
'delete a file
kill strFile
CHeers