VBA

VBA Funciones Útiles

Submitted by tanny on Mon, 11/27/2017 - 10:48

Validar si un archivo existe

'For File this function will return TRUE and
'For folder it will return FALSE
Public Function FExists(OrigFile As String)
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
FExists = fs.FileExists(OrigFile)
End Function

Validar si un directorio existe

'For File this function will return False and
'For folder it will return TRUE
Public Function DirExists(OrigFile As String)
Dim fs
Set fs = CreateObject("Scripting.FileSystemObject")
DirExists = fs.folderexist