|
-
Jul 7th, 2000, 08:55 AM
#1
Thread Starter
Lively Member
Hello you guru's :-)
I need a little help with this one.
I'm creating a program that will "create" or write program headers, body and footer.
It gets complicated when I want to "write out" in ASCII format. I would need a bunch of Sub to write info in those ASCII files.
Ex.: I'm creating a .txt file that will contain the code required to run a particular task.
private sub header
' open output file (in write mode)
' start the process
print "/*************************************************/"
print "* Program..: " & strProgramFile
print "*"
print "* Author...: " & strAuthor
print "*"
print "* Date.....: " & strCreationDate
print "/************************************************/;"
' close the output file for the moment
end sub
private Sub Body
' re-open the output file (in append mode)
' do my output stuff
' close the output file for the moment
end sub
etc...
I simply don't know how to create that .txt file. Could someone proivde me the basic stuff so that I could go on.
Sincerely,
Patrice :-)
-
Jul 7th, 2000, 09:13 AM
#2
Lively Member
To create a text file, just open it in output mode. If the file does not exist, it is created, if it does exist, it is overwritten.
Open "MyFile.txt" for Output As #1
'Then print to the file:
Print #1, "Text to print"
'When you're done, close the file:
Close #1
-
Jul 7th, 2000, 09:14 AM
#3
Try This:
Code:
Private Sub Form_Load()
Open "C:\test.txt" For Output Shared As #1
Print #1, "HI"
Close #1
End Sub
Private Sub Form_Click()
Open "C:\test.txt" For Append Shared As #1
Print #1, "HI"
Close #1
End Sub
Hope this helps
-
Jul 7th, 2000, 09:34 AM
#4
Thread Starter
Lively Member
Thanks a Bunch
Thank you very much you guys...
Wasn't looking at the right place...
Sincerely yours,
Patrice :-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|