error 5 with VBA macro under win2000

B

Bart VB

A macro which had to retrieve .lst-files from a directory
used to work under WIN98 but doesn't work anymore under
WIN2000 (first part of the macro is shown below).
I'm working with word2000.
Following error message appears for the line '.FileName
= "*.lst"' : invalid procedure call or argument.


How can this be resolved?
Many thanks for your help.

Bart


Set fs = Application.FileSearch
With fs
.LookIn = CurDir
.FileName = "*.lst"
If .Execute(SortBy:=msoSortByFileName, _
SortOrder:=msoSortOrderAscending) > 0 Then
MsgBox "There were " & .FoundFiles.Count & _
" lst file(s) found."
For I = 1 To .FoundFiles.Count
Documents.Open FileName:=.FoundFiles(I)

..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top