troyedmonds
New Member
- Joined
- Jan 8, 2013
- Messages
- 6
I have some code that uses filesearch and it does not work in 2007. Can anyone please tell me how to fix this code!!!!!
Private Sub btnBeginDateSearch_Click()
Dim FileExtension, ASCII_Space
Dim TempData
FileDirectory = "C:\Logansport\Turbidity\"
FileExtension = "*(wide).dbf"
ASCII_Space = " "
ListBox1.Clear
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Logansport\Turbidity"
.SearchSubFolders = False
CompleteFileName = MyYear + ASCII_Space + MyMonth + ASCII_Space + MyDay + ASCII_Space + FileExtension
.FileName = CompleteFileName
If .Execute() > 0 Then
If .Execute() = 1 Then
Dim Msg, Style, Title, Response
Dim Listbox1Value
CompleteFileName = .FoundFiles(1)
For i = .FoundFiles.Count To 1 Step -1
ListBox2.AddItem (.FoundFiles(i))
Next i
UpdateWorkbook2
ListBoxStatus
ElseIf .Execute() > 1 Then
CompleteFileName = .FoundFiles(1)
ListBox2.Visible = True
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
FoundFiles = .FoundFiles.Count
For i = .FoundFiles.Count To 1 Step -1
ListBox2.AddItem (.FoundFiles(i))
Next i
lblSearchByDate.Visible = True
If ListBox2.ListCount > 0 Then
End If
End If
Else
MsgBox "There were No Matching Files Found. Confine your search to the PREVIOUS THREE MyMonthS."
End If
End With
End Sub
Private Sub btnBeginDateSearch_Click()
Dim FileExtension, ASCII_Space
Dim TempData
FileDirectory = "C:\Logansport\Turbidity\"
FileExtension = "*(wide).dbf"
ASCII_Space = " "
ListBox1.Clear
Set fs = Application.FileSearch
With fs
.LookIn = "C:\Logansport\Turbidity"
.SearchSubFolders = False
CompleteFileName = MyYear + ASCII_Space + MyMonth + ASCII_Space + MyDay + ASCII_Space + FileExtension
.FileName = CompleteFileName
If .Execute() > 0 Then
If .Execute() = 1 Then
Dim Msg, Style, Title, Response
Dim Listbox1Value
CompleteFileName = .FoundFiles(1)
For i = .FoundFiles.Count To 1 Step -1
ListBox2.AddItem (.FoundFiles(i))
Next i
UpdateWorkbook2
ListBoxStatus
ElseIf .Execute() > 1 Then
CompleteFileName = .FoundFiles(1)
ListBox2.Visible = True
MsgBox "There were " & .FoundFiles.Count & " file(s) found."
FoundFiles = .FoundFiles.Count
For i = .FoundFiles.Count To 1 Step -1
ListBox2.AddItem (.FoundFiles(i))
Next i
lblSearchByDate.Visible = True
If ListBox2.ListCount > 0 Then
End If
End If
Else
MsgBox "There were No Matching Files Found. Confine your search to the PREVIOUS THREE MyMonthS."
End If
End With
End Sub