標題:
[發問]
計算資料夾內xls檔案數
[打印本頁]
作者:
acdx
時間:
2014-12-26 14:38
標題:
計算資料夾內xls檔案數
該如何計算資料夾內.xls檔案數?
mypath = ActiveWorkbook.Path & "\"
myFile = "*.xls"
myname = Dir(mypath & myFile)
n = myname.Count
結果最後一行出現錯誤
該怎麼修正?
作者:
GBKEE
時間:
2014-12-26 15:25
回復
1#
acdx
試試看
Option Explicit
Sub Ex()
Dim mypath As String, myFile As String, myname As String, n As Integer
mypath = ActiveWorkbook.Path & "\"
myFile = "*.xls"
myname = Dir(mypath & myFile)
Do While myname <> ""
n = n + 1
myname = Dir
Loop
MsgBox n
End Sub
複製代碼
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)