Pages

Thursday, January 10, 2013

UDF to check folder exists or not

If you want to check folder exists or not . Try this UDF



Function folder_exists(fld_path As String) As String

    If Len(Dir(fld_path, vbDirectory)) <> 0 And fld_path <> "" Then
        folder_exists = "Exists"
    Else
        folder_exists = "Not Exists"
    End If
    
End Function



Steps to Use
  • Copy the below code
  • Press Alt+F11 to open VBA editor
  • Paste it in any public module or module 1
  • For example you have complete folder path in Cell A1  and in cell B1 you want to know whether folder exists or not . In cell B1 type =folder_exists(A1) .

No comments:

Post a Comment