|
-
Apr 1st, 2010, 04:20 PM
#1
Thread Starter
New Member
Having Problems Deleting a File in VB6
This should be an easy one. I'm checking to see if a file exists, and if so, then I'm trying to delete it. I'm getting hung up on the actual deletion part.
My unsuccessful snippet of code is commented out in the test procedure below. The function call to FileExists works fine. Please help if you can. Thanks!
Sub test ()
Dim XMLINPUTPATH as string
XMLINPUTPATH = "C:\ABC\XML_Input.xml"
'IF THIS FILE ALREADY EXISTS, THEN DELETE IT!
If FileExists(XMLINPUTPATH) Then
'delete file
' Dim oFileSysObj
' Set oFileSysObj = ?
' oFileSysObj.Deletefile XMLINPUTPATH
End If
End Sub
Public Function FileExists(sPath As String) As Boolean
If Dir(sPath) > "" Then
FileExists = True
Else
FileExists = False
End If
End Function
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
|