I get an error when unzipping a file that contains a folder. The folder contains a couple dozen more folders and each of those folders contain files. The error occurs at this line: oApp.Namespace(CVar(FileNameFolder)).CopyHere oApp.Namespace(CVar(Fname)).items
The routine works fine if the zip file contains only files but I need it to extract folders containing files.
Dim oApp As Object, FSOobj As Object
Dim FileNameFolder As Variant
If Right(strTargetPath, 1) <> Application.PathSeparator Then
strTargetPath = strTargetPath & Application.PathSeparator
End If
FileNameFolder = strTargetPath
'create destination folder if it does not exist
Set FSOobj = CreateObject("Scripting.FilesystemObject")
If FSOobj.FolderExists(FileNameFolder) = False Then
FSOobj.CreateFolder FileNameFolder
End If
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(CVar(FileNameFolder)).CopyHere oApp.Namespace(CVar(Fname)).items
DoEvents
Set oApp = Nothing
Set FSOobj = Nothing
Set FileNameFolder = Nothing
Bookmarks