|
-
Aug 3rd, 2000, 03:50 PM
#1
Thread Starter
Member
I know how you love to hear from me, but I have a questsion (for the nth time), how do you use a delete command to delete or creat a file in vb?
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Aug 3rd, 2000, 03:56 PM
#2
_______
<?>
Here's the KIll'using fso kill a file
Code:
'before killing check for existence to avoid error on kill
'
Dim sFile$
sFile = "Path & Name Of Your File.ext"
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(sFile$) = True Then
Kill sFile
Else
MsgBox "Sorry, the specified file does not exist!"
End If
Set FSO = Nothing
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 3rd, 2000, 03:57 PM
#3
Use Kill to delete a file
-
Aug 3rd, 2000, 04:19 PM
#4
To create a file. Mainly a text file.
Code:
Open "C:\myfile.txt" For Output As #1 'Create/Overwrite if existing
Print #1, "You have just created a file called myfile.txt located in C:\ directory." 'write text
Close #1 'Close the file
Or you could open it for Append which will not overwrite the file, but add to the end of it.
Code:
Open "C:\myfile.txt" For Append As #1
Print #1, "You wrote some more text after the 'You have just created a file called...'"
Close #1
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
|