【发布时间】:2012-05-18 19:34:19
【问题描述】:
我有一个包含多个 .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 中选择在选择器中。
【问题讨论】:
标签: vba filesystems