A
Ali Campbell
I have a piece of code developed on Excel 97/Windows 98, which includes:
With Application.FileSearch
.FileName = "*."
.LookIn = cstrLocPath 'Constant containing required path string
.Execute
x = .FoundFiles.Count
End With
to count the number of files with no extension.
The code works fine on the development PC.
Another PC in the same office has Excel 97 running on Windows XP. Using Debug, Compile in the VBA Editor, no compile errors are found. However, when I run the code, I get a runtime error on trying to execute the '.FileName = "*."' line, indicating that some part of this line is invalid. If I substitute a file name in place of the wildcard (*), the problem goes away, indicating that this combination of versions doesn't like the wildcard.
Another PC in that office has Excel 2000 running on Windows XP (sorry, I can't take any responsibility for the mixture of versions on this client's site!) and the error message doesn't come up, although it didn't find any files (I'll have to go back and debug that problem separately).
Does anyone know a workaround for the Excel 97/Windows XP problem with the wildcard in a FileSearch? (I have a feeling I've had a different problem with wildcards on that PC in the past, but just wrote a workaround on that occasion).
Thanks and regards
With Application.FileSearch
.FileName = "*."
.LookIn = cstrLocPath 'Constant containing required path string
.Execute
x = .FoundFiles.Count
End With
to count the number of files with no extension.
The code works fine on the development PC.
Another PC in the same office has Excel 97 running on Windows XP. Using Debug, Compile in the VBA Editor, no compile errors are found. However, when I run the code, I get a runtime error on trying to execute the '.FileName = "*."' line, indicating that some part of this line is invalid. If I substitute a file name in place of the wildcard (*), the problem goes away, indicating that this combination of versions doesn't like the wildcard.
Another PC in that office has Excel 2000 running on Windows XP (sorry, I can't take any responsibility for the mixture of versions on this client's site!) and the error message doesn't come up, although it didn't find any files (I'll have to go back and debug that problem separately).
Does anyone know a workaround for the Excel 97/Windows XP problem with the wildcard in a FileSearch? (I have a feeling I've had a different problem with wildcards on that PC in the past, but just wrote a workaround on that occasion).
Thanks and regards