使用特定的通配符打开此目录中的所有文件 [英] Open all files in this directory with a specific wildcard
本文介绍了使用特定的通配符打开此目录中的所有文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
它的标题很简单。我需要能够打开具有 x .xlsx但不是* xy.xlsx的文件夹的文件。
只需不知道该怎么做我可以获取文件目录,然后使用星号选择所有带有x的文件。但是我有文件,我不想打开,唯一的改变是文件名末尾他们有少量文本(y)。
这是我到目前为止。我将添加什么。
Workbooks.Open(Dir& FileNameStart&*)
$ 解决方案
pre> Dim f
f = Dir(SrcPath&* x * .xlsx,vbNormal)
Do While Len(f)> 0
如果不是像* y.xlsx那样,那么
Workbooks.open SrcPath& f
'...
如果
f = Dir()
循环
Its is simple as the title puts it. I need to be able to open files with a folder that have "x.xlsx" but not "*xy.xlsx".
Just not sure how to do it. I can get the the file directory and then use a asterisk to select all files with "x". but i have files that i don't want to open with the only change being that at the end of the file name they have a small amount of text ("y").
this is what i have so far. what would i add.
Workbooks.Open (Dir & FileNameStart & "*")
hope this is clear.
解决方案
Dim f
f = Dir(SrcPath & "*x*.xlsx", vbNormal)
Do While Len(f)>0
If not f like "*y.xlsx" Then
Workbooks.open SrcPath & f
'...
end if
f = Dir()
Loop
这篇关于使用特定的通配符打开此目录中的所有文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文