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
========
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
========