【发布时间】:2015-04-10 16:06:37
【问题描述】:
如何使用 VBA 代码从多个 zip 文件中提取 Excel 文件。
我的文件夹有多个 zip 文件。这些 zip 文件包含 Excel 文件.xls。如何为此构建 VBA 代码并将所有 Excel 文件保存到一个文件夹中?
【问题讨论】:
如何使用 VBA 代码从多个 zip 文件中提取 Excel 文件。
我的文件夹有多个 zip 文件。这些 zip 文件包含 Excel 文件.xls。如何为此构建 VBA 代码并将所有 Excel 文件保存到一个文件夹中?
【问题讨论】:
试试这个代码。
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
【讨论】: