【问题标题】:VBA code to extract Excel files from Multiple zip files从多个 zip 文件中提取 Excel 文件的 VBA 代码
【发布时间】:2015-04-10 16:06:37
【问题描述】:

如何使用 VBA 代码从多个 zip 文件中提取 Excel 文件。

我的文件夹有多个 zip 文件。这些 zip 文件包含 Excel 文件.xls。如何为此构建 VBA 代码并将所有 Excel 文件保存到一个文件夹中?

【问题讨论】:

    标签: excel vba


    【解决方案1】:

    试试这个代码。

         Dim fso As New FileSystemObject
         Dim fldr As Folder
         Dim file1 As File
    
         Dim objApp As Object
         Set objApp = CreateObject("Shell.Application")
         objApp.Namespace(Destinationfolder &"\").CopyHere (objApp.Namespace(Zippedfilepath).Items)
         Set fldr = fso.GetFolder(Destinationfolder)
    
         For Each file1 In fldr.Files
             If file1.Type <> "Microsoft Excel Worksheet" Then
                file1.Delete
             End If
        Next    
    

    【讨论】:

    • 嗨,该链接只会提取 zip 文件,但我只需要从多个 zip 文件中提取 excel 文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-07-26
    • 1970-01-01
    • 1970-01-01
    • 2023-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多