Sub 同資料夾內大量檔案存取()
Dim Path As String, file As String
Application.ScreenUpdating = False '關閉屏幕更新
Path = "C:\資料夾\" '來源資料夾,自行修正
file = Dir(Path & "*.xls") '來源檔名, 表示法 "*.xls" or "*.csv" or "關鍵字*.xls"
Do While file <> ""
Application.DisplayAlerts = False '一般提警示訊息關閉
With Workbooks.Open(Path & file)
[A1] = "=[活頁簿1.xls]Sheet1!A1" '活頁簿1.xls 名稱自行修正
ActiveWindow.Close True
End With
file = Dir
Loop
Application.ScreenUpdating = True '打開屏幕更新
End Sub作者: rbktwi 時間: 2015-1-14 14:51
Sub 幕後開啟EXCEL_寫入()
Dim X As New Application
With X.Workbooks.Open("D:\XXX.xls")
.Sheets("Sheet1").[A65536].End(xlUp)(2) = Now
.Close 1
End With
End Sub