【发布时间】:2015-12-23 20:31:20
【问题描述】:
我有一个电子表格,可以查看给定目录中的其他几个电子表格,以从中提取一些统计信息。到目前为止,它到达了第一个文件并一遍又一遍地点击它。
我的代码是这样的:
Public Sub GetResults()
Const strDirectory As String = "SomeNetworkLocation"
Dim strFileName As String
strFileName = Dir(strDirectory & "*.xl??")
Do While strFileName <> ""
If strFileName Like "SomeMatchingScheme_##_??"
Workbooks.Open strDirectory & strFileName
'Do stuff with the workbook
Workbooks(strFileName).Close
End If
Loop
End Sub
有什么建议吗?
【问题讨论】: