標題:
製指定 C檔位有檔名之檔案
[打印本頁]
作者:
tomking
時間:
2011-12-21 11:09
標題:
製指定 C檔位有檔名之檔案
DEAR 大大..
請教,如何改成, C1欄位..一直往下,
PS: 複製指定 C檔位有檔名之檔案
Sub file_move()
Set fds = CreateObject("Scripting.filesystemobject")
fd = [a1]
fo = [b1]
fa=[c1].value ---> ?
fs = Dir(fd & fa)
Do Until fs = "" --->??
If fds.FileExists(fo & fs) Then
MsgBox "目標資料夾,有來源之同檔名檔案,請確認", vbOKOnly, "錯誤訊息"
Exit Sub
End If
fds.copyfile fd & fs, fo & fs
fs = Dir
Loop
End Sub
再麻煩...
作者:
GBKEE
時間:
2011-12-22 15:11
回復
1#
tomking
是這樣嗎?
Option Explicit
Sub file_move()
Dim fds As Object, fd As String, fo As String, fs As String, i As Integer
Set fds = CreateObject("Scripting.filesystemobject")
fd = [a1]
fo = [b1]
i = 1
Do While Cells(i, "C") <> ""
fs = Dir(fd & Cells(i, "C"))
If fs = "" Then Exit Do
If fds.FileExists(fo & fs) Then
MsgBox "目標資料夾,有來源之同檔名檔案,請確認", vbOKOnly, "錯誤訊息"
Exit Sub
End If
fds.copyfile fd & fs, fo & fs
i = i + 1
Loop
End Sub
複製代碼
作者:
tomking
時間:
2011-12-22 16:27
感謝版主
冬至將到 ,冬至快樂...
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)