【发布时间】:2020-06-25 05:37:45
【问题描述】:
我正在尝试将文件从一个文件夹移动到另一个文件夹。如果文件名已经存在于新文件夹中,我需要在标题末尾使用创建日期重命名。以下是我目前所拥有的
Private Sub LetsMove_Click()
Application.ScreenUpdating = False
'Move all files from OldAddressTextBox to NewAddressTextBoxand append the created date to the name if new file title already exists.
Dim mergeObj As Object, dirObj As Object, filesObj As Object, everyObj As Object, errResult As String
Set mergeObj = CreateObject("Scripting.FileSystemObject")
Set dirObj = mergeObj.Getfolder(OldAddressTextBox.Text)
Set filesObj = dirObj.Files
For Each everyObj In filesObj
mergeObj.CopyFolder Source:=OldAddressTextBox.Text, Destination:=NewLocationTextBox.Text
errResult = mergeObj.Rename(mergeObj.CreationDate)
Next
MsgBox "You can find the files and subfolders from " & OldAddressTextBox.Text & " in " & NewLocationTextBox.Text
End Sub
【问题讨论】:
-
您究竟需要什么帮助?关于要使用的逻辑,命令...