只是想知道......我有一段代碼 - 在excel中允許我在給定目錄中打開文件的宏。問題是我只想打開.xls文件,我打開的代碼打開了給定目錄中的所有文件。使用宏在給定的目錄中只打開.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
嘗試已經......無論如何都不會工作...謝謝。 – Saint