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 spec­i­fied folder exists; False if it does not.

Format : 

objectOf­FileSys­te­mOb­ject. FolderExists(foldername)

Arguments: 
  • objectOf­FileSys­te­mOb­ject
    • As the names says, it’s a FileSystemObject.
    • fold­er­name
      • Manda­tory
      • Type:     String
      • Folder , whose exis­tence 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 

Msg­box FnIs­FolderEx­ist (“c:\New Folder”)

 

You may also like...

2 Responses

  1. NAVEEN C N says:

    I have the folder key­words in col­umn A, Direc­tory( Path) in col­umn B. I need a a macro that search for the folder with key­word in the direc­tory and out­put the folder present/ folder not present in col­umn C and if present it should out­put mod­i­fied date of that folder in col­umn D.

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

    Col­umn C: Folder present/ Folder not present ( Expected out­put)
    Col­umn 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 …iter­ate the rows, get the path from col­umn A ..check the folder and dis­play the sta­tus to the cor­re­spond­ing rows. Keep iter­at­ing.
      Do let me know if u face any prob..I will pro­vide the entire implementation.

Leave a Reply

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

%d bloggers like this: