Dear Pieter
1. Add a form to a project.
2. Add the following controls:
2.a. DriveListBox (named Drive1 that I have used in he
code) and DirListBox (dir1) for selecting the path. You
may remove these if you have a predefined pathname or
want to have it inputted thru TextBox.
2.b. TextBox (txtFileSize) to input the File Size (which
you want to search)
2.c. Calendar Control (Calendar1) for selecting the date
(in the acceptable date format).
2.d. TextBox (txtResult) with txtResult.multiline=True
and txtResult.ScrollBars =2 (Vertical) for viewing the
result. You can dispense with this also.
2.e. CommandButton (Command1) that will populate the
txtResult.
3. Now Paste the following code to the form:
'************Code follows:
Private Sub Command1_Click()
PopulateGrid Dir1.Path
End Sub
Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
Dir1.Refresh
End Sub
Public Sub PopulateGrid(sPath As String)
Dim sFileName As String
Dim dFileDate As Date
Dim lFileSize As Long
Dim flag As Boolean
txtResult.Text = ""
sFileName = Dir(sPath & "\*.*")
Do
dFileDate = FileSystem.FileDateTime(sPath & "\" &
sFileName)
lFileSize = FileSystem.FileLen(sPath & "\" &
sFileName)
flag = False
If dFileDate > Calendar1.Value Then
flag = True
End If
If lFileSize = Val(txtFileSize) Then
flag = True
End If
If flag = True Then
txtResult.SelStart = Len(txtResult.Text)
txtResult.SelText = sFileName & Space(10) &
lFileSize & Space(10) & dFileDate & vbCrLf
End If
sFileName = Dir()
Loop Until Len(sFileName) = 0
End Sub
'************Code ends
4. Run the Form.
This should work and satisfy whatever you want to do with
it.
IRFAN.
NEVER USE YOUR ACTUAL E-MAILID on this forum.
I used it once and am getting about 80 virus-infected
mails, supposedly from Microsoft.