只是想知道......我有一段代码 - excel中的一个宏,允许我打开给定目录中的文件。问题是我只想打开 .xls 文件,而我拥有的代码会打开给定目录中的所有文件。
谁能帮我解决这个问题。
谢谢。
Sub FindOpenFiles()
Dim FSO As Scripting.FileSystemObject, folder As Scripting.folder, file As Scripting.file, wb As Workbook
Dim directory As String
directory = "O:\test"
Set FSO = CreateObject("Scripting.FileSystemObject")
Set folder = FSO.GetFolder(directory)
For Each file In folder.Files
Workbooks.Open file
Next file
End Sub