Verify and delete a file to a specific location

Share this post
FaceBook  Twitter  Mixx.mn     

To Create a Text File at given path, use following code:
Steps:
1) Create a FileSystem Object

2) Verify if File/folder exist at a given location

3) Delete file if already exist  


Code:

'Create a Text File at given path
'==============================================
Function Create_TextResults_File(FilePath)
'1) Create a FileSystem Object
Set fso = CreateObject("Scripting.FileSystemObject")


'2) Verify if File/folder exist at a given location
If fso.FileExists(FilePath) Then

'3) Delete file if already exist '
   fso.DeleteFile FilePath
End If