XLA routines: EE_DeleteFile
EE_DeleteFile deletes a file if it exists.
Sub EE_DeleteFile(strFilePath As String, Optional blnShowMsg As Boolean = False) '- takes file path '- deletes file '- does not error if file does not exist '- does error if file is locked 'http://excelexperts.com/xla-routines-eeDeleteFile for updates on this sub routine With CreateObject("Scripting.FileSystemObject") If .FileExists(strFilePath) Then On Error Resume Next .deletefile strFilePath If Err.Number <> 0 And blnShowMsg = True Then MsgBox Err.Description, vbCritical, "File locked" End If On Error GoTo 0 End If End With End Sub
»
- Nick's blog
- Login or register to post comments
- 2723 reads
Recent comments
5 years 34 weeks ago
6 years 20 weeks ago
6 years 32 weeks ago
6 years 35 weeks ago
6 years 36 weeks ago
6 years 42 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago
6 years 50 weeks ago