error 5 in macro when retrieving files in win2000 (no problem in win98)

B

bart

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 on 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)

..
 
P

Perry

Hi Bart,

Looks like some VBA references got broken.
Try to uncheck the references (VBE menu: Tools|References)
on a Win98 machine.
Then open your template on a Win2K machine and reinstate the
references you turned of.

Kindly repost, if this doesn't remedy
detailing as much as possible.

Note: Backup original templates beforehand

Krgrds,
Perry
 
B

bart

Thanks, Perry, but unfortunately didn't help.
FYI I couldn't check out all preferences (VB for apllic,
MSW9.0 obj libr. and MSforms2.0 obj libr.)
OLE automation and MSoffice9.0 obj libr were checked again
on the win2K machine (though for the latter it was version
10.0).

Any other suggestion?

Thanks.
BArt
 

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