Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

FileSystemObject : FolderExists Method

Description: 

Returns True if a specified folder exists; False if it does not.

Format : 

objectOfFileSystemObject. FolderExists(foldername)

Arguments: 
  • objectOfFileSystemObject
    • As the names says, it’s a FileSystemObject.
    • foldername
      • Mandatory
      • Type:     String
      • Folder , whose existence to be determined.

 

Function FnIsFolderExist(strCompleteFolderPath)
      Set fso = CreateObject("Scripting.FileSystemObject")
      If fso. FolderExists(strCompleteFolderPath)Then
                    strStatus = strCompleteFolderPath & “  folder exists”
            Else
                    strStatus = strCompleteFolderPath & “  folder does not exist”
           End If
        FnIsFolderExist = strStatus
End Function 

Msgbox FnIsFolderExist (“c:\New Folder”)

 

You may also like...

2 Responses

  1. NAVEEN C N says:

    I have the folder keywords in column A, Directory( Path) in column B. I need a a macro that search for the folder with keyword in the directory and output the folder present/ folder not present in column C and if present it should output modified date of that folder in column D.

    Ex:
    Column A: 20140605
    Directory(Path)- \\nasmsb1\ap\ISBPRO\Atwater\IMPORT\HISTORY\DMV_CASB_RO_R60_PLATE_Errors

    Column C: Folder present/ Folder not present ( Expected output)
    Column D: 5/6/2014 11:25 PM

    I need a macro with loop( iteration)

    Thanks in advance for your help

    • sumitjain says:

      It sudnt take much time I guess. Get the rows count using usedrange.rows.count …iterate the rows, get the path from column A ..check the folder and display the status to the corresponding rows. Keep iterating.
      Do let me know if u face any prob..I will provide the entire implementation.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: