我有一个包含多个 .txt 文件的目录。假设
hi.txt
hello.txt
hello_test.txt
test.txt
在VBA中使用文件对话框,如何过滤只显示与“*test.txt”匹配的文件(即最后两个)?或者我只能使用*.筛选器吗?
以下代码似乎应该可以工作,但实际上并不起作用:
Sub TestIt()
Dim test As Variant 'silly vba for not having a return type..
test = Application.GetOpenFilename(FileFilter:="test (*test.txt), *test.txt")
End Sub
编辑:澄清一下,以免造成混淆:我想筛选出 "test.txt" 而不是 ".txt" 文件,这样我就可以只从 hello_test.txt 和 test.txt 中选择。