khalid79m
07-28-2008, 03:22 AM
Private Sub JuneUpdate2()
newStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "Preparing Reports"
Dim i As Integer, wb As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "\\a\dfsroot\GB99\SA\ST\MAAI\SiteRs\20099 (file://\\a\dfsroot\GB99\SA\ST\MAAI\SiteRs\20099)"
.SearchSubFolders = False
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count
'Open each workbook
Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
'Perform the operation on the open workbook
Run "June"
'Save and close the workbook
wb.Close savechanges:=True
'On to the next workbook
Next i
End With
Application.ScreenUpdating = True
Application.StatusBar = False
Application.DisplayStatusBar = newStatusBar
End Sub
This bit of code works fine in on my PC, and I am using excel 2003. I have to migrate this peace to our global offices and when they run this in excel 2003 they get the following message :
Method 'FileSearch' of object '_Application' failed
and the line With Application.FileSearch is highlighted ?
Can someone help, its my last day today.. before I go on holiday and I need to transfer this peice of work :help :help
newStatusBar = Application.DisplayStatusBar
Application.DisplayStatusBar = True
Application.StatusBar = "Preparing Reports"
Dim i As Integer, wb As Workbook
With Application.FileSearch
.NewSearch
.LookIn = "\\a\dfsroot\GB99\SA\ST\MAAI\SiteRs\20099 (file://\\a\dfsroot\GB99\SA\ST\MAAI\SiteRs\20099)"
.SearchSubFolders = False
.Filename = "*.xls"
.Execute
For i = 1 To .FoundFiles.Count
'Open each workbook
Set wb = Workbooks.Open(Filename:=.FoundFiles(i))
'Perform the operation on the open workbook
Run "June"
'Save and close the workbook
wb.Close savechanges:=True
'On to the next workbook
Next i
End With
Application.ScreenUpdating = True
Application.StatusBar = False
Application.DisplayStatusBar = newStatusBar
End Sub
This bit of code works fine in on my PC, and I am using excel 2003. I have to migrate this peace to our global offices and when they run this in excel 2003 they get the following message :
Method 'FileSearch' of object '_Application' failed
and the line With Application.FileSearch is highlighted ?
Can someone help, its my last day today.. before I go on holiday and I need to transfer this peice of work :help :help