Excel 2003 VBA Help me complete this Search script
This is how I have it now. I tried to step into the Sub in the VBE,
but it won't let me, nothing is happening,
and the Sub don't show as a Marco that I can play, so I think I am
doing something wrong:
Sub FileFound(strFileName As String)
Dim path As Variant
Set fs = Application.FileSearch
With fs
.LookIn = "c:\Kevin\"
.SearchSubFolders = True
.Filename = strFileName & "*.txt"
.FileType = msoFileTypeAllFiles
If .Execute() 0 Then
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
Else
MsgBox "There were no files found."
End If
ActiveSheet.Range("A1") =
Application.Transpose(ExtractNewFileName(strFileNa me))
Cells.EntireColumn.AutoFit
End With
End Sub
Function ExtractNewFileName(Filename As String) As String
Dim strFn As String
strFn = Mid(Filename, Len(Filename) - 11, 8) = 20071201 And
Mid(Filename, Len(Filename) - 11, 8) <= 20071212
ExtractNewFileName = strFn
End Function
|