|
-
May 22nd, 2007, 07:13 PM
#1
Thread Starter
Lively Member
Creating files...
How can I create a file (.txt) using coding?
-
May 22nd, 2007, 07:20 PM
#2
Re: Creating files...
Here ya go
Code:
Dim ff As Integer
ff = FreeFile
Open App.Path & "\someFile.txt" For Append As #ff
Print #ff, Text1.Text
Close #ff
If a post has been helpful please rate it. 
If your question has been answered, pull down the tread tools and mark it as resolved.
-
May 22nd, 2007, 07:27 PM
#3
Thread Starter
Lively Member
-
May 22nd, 2007, 10:17 PM
#4
Addicted Member
Re: Creating files...
You actually want a SAVED text file, don't you? Well, here's what you do:
First, create a RichTextBox, name it rtfTextToSave, set its Text property to whatever text you want the text file to hold, then make it invisible.
Last, copy and paste the following code into the procedure you want to save the text file.
VisualBasic60 Code:
Dim sFile
'replace c:\yourFile.doc with the file name, extension and path you want
sFile = "c:\yourFile.doc"
rtfTextToSave.SaveFile sFile
If it's a text file you want to create, tell your users to open up Microsoft Word (actually the word processor to use depends on the extension you use, and it has to be a processor that can save as plain text) and save it as a plain text file. OK, Visual Basic won't actually create the text file, as you can see. That means more work for the users.
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
|