Results 1 to 4 of 4

Thread: I know everyone LOVES to hear from me...

  1. #1

    Thread Starter
    Member Cahlel's Avatar
    Join Date
    Aug 2000
    Location
    Earth (I think)
    Posts
    63

    Smile

    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

  2. #2
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    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

  3. #3
    Guest
    Use Kill to delete a file
    Code:
    Kill "MyFile.txt"

  4. #4
    Guest
    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
  •  



Click Here to Expand Forum to Full Width