1)CHDIR: Statement

     

  • It is a statement
  • CH represents to CHANGE., DIR = directory
  • This stament is useful to change the path
  • Path may be Drive (or) Directory\folder
  •  

    Change the path: Chdir path

     

    Ex: ChDir "D:\abc"

     

     

    2)CHDrive: To change the drive

     

     

     

    3)CurDir: denotes about current directory path

     

     

    4)Dir: Function

     

  • DIR represnts DIRECTORY
  • It used to specify the name of folder
  •  

    Syntax of DIR:

     

     

  • Path Name: indicates where the DIRECTORY\FOLDER is located
  •  

  • Path Name: indicates where the DIRECTORY\FOLDER is located
  • Ex: Dir("D:\Consolidation\") means i am referring, CONSOLIDATION folder\directiory in my "D" drive

     

  • DIR Function always returns STRING
  •  

  • A zero length string is returned if path is not found
  •  

    5)FileCopy: Statement

     

     

  • SourceFile:Name of the file to be copied., It consists of path of file also i.e directory\file
  •  

  • Destination: Directory\folder where we need to paste
  •  

    To copy a ZIP file from SOURCE to DESTINATION:

     

    Sub FileCopy_Folder_To_Folder()
    Dim SourcePath, DestinationPath
    SourcePath = "C:\Users\pavan kumar\Downloads\"
    Filename = Dir(SourcePath & "*.zip")
    DestinationPath = "C:\Users\pavan kumar\Downloads\abcdefg\"
    FileCopy SourcePath & Filename, DestinationPath & Filename
    End Sub

     

    6)FileDateTime - Function

     

  • It returns time and date of last change of file
  •  

     

    7)FileLen - Function

     

  • It returns length of file
  •  

     

    8)Getattr - Function

     

  • It returns a number which represents to attributes of file
  •  

    Attributes of file
    Value\Integer
    File Status
    0
    Normal
    1
    Read-only
    2
    Hidden
    16
    Directory\folder

     

     

     

    9)GetOpenFileName - Method

     

  • This method enables the user to select the file to open, manually through dialogue box
  •  

    10)GetSaveasFileName - Method

     

  • Enables the user to save through dialogue box
  •  

     

    11)Kill - Method

     

     

    Copy the code: To delete all text files in a folder:

     

    Sub Kill_Files_in_a_Directory()
    'to delete all text files available in "D\Consolidation" folder
    Kill ("D:\Consolidation\*.TXT")
    End Sub

     

    12)Remove\Delete the Folder

     

    Sub RemoveDirectiory()
    'To create a Folder in C drive
    MkDir ("C:\FolderName")

    'To remove the folder in C drive
    RmDir ("C:\FolderName")
    End Sub