Ranjit Goray
June 22nd, 2000, 03:44 AM
I have to display files in a grid in dat/time order of the files created...
Please help.....
I am able to store the files but how can i sort them....
I have also given the exact function below that i have written
'*************My function****************
Function AuLoadGrid()
Dim str As String
Dim i As Long
'Declaring variables
Dim fs, f, fc, f1 As Object
Dim s As String
'Creating a FileSystemObject
Set fs = CreateObject("Scripting.FileSystemObject")
'Getting the Folder from which files have to be read
Set f = fs.Getfolder("C:\Temp\Temp")
Set fc = f.Files 'fc object to store the files in the
'specified folder
i = 1
'Iterating through the Files Collection to display each file
'in the grid
For Each f1 In fc
msfGrid.TextMatrix(i, 0) = f1.Name 'Displaying the file name
msfGrid.TextMatrix(i, 1) = f1.DateCreated 'Date &Time when the
'file was created
'Depending on the file Type from the Type object
'changing the File Status column in the grid
If CStr(f1.Type) = "BAK File" Then
msfGrid.TextMatrix(i, 2) = "In Use"
ElseIf CStr(f1.Type) = "Text Document" Then
msfGrid.TextMatrix(i, 2) = "Rejected Transactions"
ElseIf CStr(f1.Type) = "XML File" Then
msfGrid.TextMatrix(i, 2) = ""
Else
msfGrid.TextMatrix(i, 2) = ""
End If
'Incrementing the Grid Rows and the Grid Row index
msfGrid.Rows = msfGrid.Rows + 1
i = i + 1
Next
msfGrid.Rows = msfGrid.Rows - 1
'disassociating the object variables
Set fs = Nothing
Set f = Nothing
Set fc = Nothing
Set f1 = Nothing
End Function
Please help.....
I am able to store the files but how can i sort them....
I have also given the exact function below that i have written
'*************My function****************
Function AuLoadGrid()
Dim str As String
Dim i As Long
'Declaring variables
Dim fs, f, fc, f1 As Object
Dim s As String
'Creating a FileSystemObject
Set fs = CreateObject("Scripting.FileSystemObject")
'Getting the Folder from which files have to be read
Set f = fs.Getfolder("C:\Temp\Temp")
Set fc = f.Files 'fc object to store the files in the
'specified folder
i = 1
'Iterating through the Files Collection to display each file
'in the grid
For Each f1 In fc
msfGrid.TextMatrix(i, 0) = f1.Name 'Displaying the file name
msfGrid.TextMatrix(i, 1) = f1.DateCreated 'Date &Time when the
'file was created
'Depending on the file Type from the Type object
'changing the File Status column in the grid
If CStr(f1.Type) = "BAK File" Then
msfGrid.TextMatrix(i, 2) = "In Use"
ElseIf CStr(f1.Type) = "Text Document" Then
msfGrid.TextMatrix(i, 2) = "Rejected Transactions"
ElseIf CStr(f1.Type) = "XML File" Then
msfGrid.TextMatrix(i, 2) = ""
Else
msfGrid.TextMatrix(i, 2) = ""
End If
'Incrementing the Grid Rows and the Grid Row index
msfGrid.Rows = msfGrid.Rows + 1
i = i + 1
Next
msfGrid.Rows = msfGrid.Rows - 1
'disassociating the object variables
Set fs = Nothing
Set f = Nothing
Set fc = Nothing
Set f1 = Nothing
End Function