Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Alonsa Miller   on Feb 01 In MS Office Category.

  
Question Answered By: Blake Smith   on Feb 01

With Application.FileSearch
.NewSearch
.FileType = msoFileTypeExcelWorkbooks
'.LookIn = "C:\Data"
.LookIn = UserForm1.txtLocation.Text
'.FileTypes
.SearchSubFolders = True
.Execute SortBy:=msoSortByFileType
If .FoundFiles.Count Then
UserForm1.Label4.Caption = .FoundFiles.Count
UserForm1.Repaint
For lFile = 1 To .FoundFiles.Count
On Error GoTo myerrhand
If UCase(Right(.FoundFiles(lFile), 3)) = "XLS" Then
Workbooks.Open Filename:=.FoundFiles(lFile), UpdateLinks:=0
xbook = ActiveWorkbook.Name
If UCase(xbook) <> "STDRPT1.XLS" Then
Application.StatusBar = "Now working on " &
ActiveWorkbook.FullName
'Here is the line that calls the macro below, passing the
workbook to it
DoChanges
ActiveWorkbook.Save
Application.DisplayAlerts = False
Windows(xbook).Close
End If
End If

myerrhand:
Windows(ActiveWorkbook.Name).Activate
Next lFile
End If
End With

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on To find .XLS file in a folder Or get search suggestion and latest updates.


Tagged: