J
Jan Kronsell
I have the following code:
Set fs = Application.FileSearch
With fs
.LookIn = "C:\test"
.Filename = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
Sheets(1).Range("a1").Value = 10
ActiveWorkbook.Save
ActiveWorkbook.Close
Next i
Else
MsgBox "There were no files found."
End If
End With
One one pc it works allright, but on another i does not. One thje not
working one I get
Runtime error '1004'
Method 'Filesearch' of object '_application' failed
Both runs Win XP and Excel XP and both has the same refrences set.
Does anyone know, what could be the problem?
Jan
Set fs = Application.FileSearch
With fs
.LookIn = "C:\test"
.Filename = "*.xls"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" file(s) found."
For i = 1 To .FoundFiles.Count
Workbooks.Open Filename:=.FoundFiles(i)
Sheets(1).Range("a1").Value = 10
ActiveWorkbook.Save
ActiveWorkbook.Close
Next i
Else
MsgBox "There were no files found."
End If
End With
One one pc it works allright, but on another i does not. One thje not
working one I get
Runtime error '1004'
Method 'Filesearch' of object '_application' failed
Both runs Win XP and Excel XP and both has the same refrences set.
Does anyone know, what could be the problem?
Jan