Zip提取后的Excel宏不同文件名

时间:2016-03-03 08:49:39

标签: excel vba macros

这是我的代码:

Sub TestRun()

   ' Define variables
    Dim file As String, folder As String
    ' Define working directory

folder = "E:\MainFolder\Appointments\"

 ' Define type of file to search for
    file = Dir(folder & "*.zip")

ZipPath = "E:\MainFolder\Appointments\" & file

    Call UnZip(folder, ZipPath) 
End Sub

我想在提取后使用不同的文件名。我希望它是appointmentments.csv而不是文件

1 个答案:

答案 0 :(得分:1)

您可以在解压缩后使用Name函数重命名文件

Name folder & oldFilename As folder & newFilename