Excel VBA 对文件 重命名

Sub rename()
With Application.ActiveSheet
basePath = Application.ActiveWorkbook.Path
i = 1
Do While (.Cells(i, 1) <> “”)
strFileName = basePath & “\” & .Cells(i, 1) & “.pdf”
If Dir(strFileName, 16) <> Empty Then
      Name strFileName As basePath & “\” & .Cells(i, 2) & “.pdf”
    End If
i = i + 1
Loop
End With
End Sub

    原文作者:webmastor
    原文地址: https://blog.csdn.net/webmastor/article/details/118060825
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞