P
petecjr
I have been using the VBA subroutine "BATCH" below in WORD 2003 to perform
any desired series of actions on all of the files in a given folder. I
recently upgraded to Office 2007 and when I run the subroutine I receive the
Run-Time Error 5111 "This command ("With Application.FileSearch") is not
available on this platform. Is there a way to do this in VBA for Office 2007.
Please help. Thanks.
Sub BATCH()
'This routine is used to perform actions on all files in a folder.
Dim LISTNAME(500)
With Application.FileSearch
..FileName = "*.*"
..LookIn = CurDir
If .Execute(msoFileFindSortbyFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For I = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(I) '(Use this if needed)
'Insert actions to be performed.
ActiveDocument.SAVE ' (Use this if needed)
ActiveWindow.Close ' (Use this if needed)
Next I
End If
End With
End Sub
any desired series of actions on all of the files in a given folder. I
recently upgraded to Office 2007 and when I run the subroutine I receive the
Run-Time Error 5111 "This command ("With Application.FileSearch") is not
available on this platform. Is there a way to do this in VBA for Office 2007.
Please help. Thanks.
Sub BATCH()
'This routine is used to perform actions on all files in a folder.
Dim LISTNAME(500)
With Application.FileSearch
..FileName = "*.*"
..LookIn = CurDir
If .Execute(msoFileFindSortbyFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
For I = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(I) '(Use this if needed)
'Insert actions to be performed.
ActiveDocument.SAVE ' (Use this if needed)
ActiveWindow.Close ' (Use this if needed)
Next I
End If
End With
End Sub