Friday, March 6, 2015

Reading files by File System Object (FSO) in VBA

This subroutine reads all files where the excel file is located.

Public Sub ReadFiles()
   
    Dim FSO As New FileSystemObject
    Dim MyFiles As Folder
    Dim MyFile As File
   
     Set MyFiles = FSO.GetFolder(ActiveWorkbook.path)  'the path of the excel file
   
    For Each MyFile In MyFiles.Files
   
                Print MyFile,name
                'Do something

    Next
 
End Sub

No comments:

Post a Comment

Applying SMA10/20, SMA20/50 as trading signals

This is the comparison for results before and after applying SMA10/20 and SMA20/50 in the stock trader. Background Trading 3 stock ma...