Application.Filesearch replacement for 2007

cwcastro

New Member
Joined
Nov 2, 2011
Messages
2
Hello Everyone,

The following code has been working for excel 2003 but recently upgraded to 2007.

Could somebody help me re-write it.

Thanks in advance!

======
Sub FindThatFile()

Dim strMyString As String

strMyString = UserForm30.TextBox1.Value


With Application.FileSearch
.Filename = strMyString
.LookIn = "\\PartNumbers\drafting"
.FileType = msoFileTypeAllFiles

.SearchSubFolders = True
.MatchTextExactly = True

.Execute


If .Execute() > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count

UserForm31.TextBox1.Text = .FoundFiles(i)
UserForm31.Show


Next i
UserForm30.TextBox1.AutoTab = True
UserForm30.TextBox1.SetFocus
UserForm30.TextBox1.Value = "00"

Else

MsgBox "That Part Number has NOT been scanned or it Does NOT Exist", _
vbExclamation + vbOKOnly, _
"Sorry!"
UserForm30.TextBox1.AutoTab = True
UserForm30.TextBox1.SetFocus

End If
End With
End Sub
========
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,226,223
Messages
6,189,710
Members
453,566
Latest member
ariestattle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top