copy files by name patterns with wildcard
Thanks Stefan, fso.CopyFile is the very method I was looking for, it works!
By the way, what does the $ sign means in Dir$ function? XL Help doesn't
mention this format.
Regards,
Stefi
€˛stefan onken€¯ ezt Ć*rta:
hi Stefi,
you could use FSO:
Set fso = CreateObject("Scripting.FileSystemObject")
fso.CopyFile "D:\test\filename*.ext", "D:\test\test\"
or
strPath = "D:\test\"
strNewPath = "D:\test\test\"
file = Dir$(strPath & "filename*.ext")
Do While file < ""
FileCopy strPath & file, strNewPath & file
file = Dir$()
Loop
bye
stefan
On 30 Mai, 08:43, Stefi wrote:
Hi All,
Can I copy files via VBA by name patterns with wildcard characters like in
DOS:
copy filename*.ext ...
I know how to find file names matching the pattern and copy them
individually (in a loop), my question is that can it be done with a single
statement?
Thanks,
Stefi
|