VBA重命名文件或文件夹
Sub 重命名文件或者文件夹()
Dim sourctfile As String
Dim destinationfile As String
Dim spath As String
SourceFile = Application.InputBox(prompt:="请输入需要重命名文件或文件夹的名称:", _
Title:="源文件", Type:=2)
Destination = Application.InputBox(prompt:="请输入文件或文件夹的新名称:", _
Title:="目标文件", Type:=2)
spath = ThisWorkbook.Path & "\"
SourceFile = spath & sourctfile
Destination = spath & destinationfile
If Len(Dir(SourceFile, vbDirectory)) > 0 Then
Name SourceFile As destinationfile
MsgBox "重命名成功!"
Else
MsgBox "文件或文件夹" & SourceFile & "不存在!"
End If
End Sub
原文地址:https://blog.csdn.net/qq490525427/article/details/139365484
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!