Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listing contents of a .zip file? 1

Status
Not open for further replies.

Ed2020

Programmer
Nov 12, 2001
1,899
GB
Hi,

If I have a list of .zip files is it possible, in VBA, to list the names of the files stored within it?

I've done some Googling, but haven't found anything so far...

Any help would be much appreciated.

Cheers,

Ed Metcalfe.

Please do not feed the trolls.....
 
Assuming you work with "zip" archive, your windows can unzip file, with reference to "shell32.dll":
Code:
Dim shApp As Shell32.Shell
Dim shFolder As Shell32.Folder, shFolder2 As Shell32.Folder
Dim shFolderItem As Shell32.FolderItem, shFolderItem2 As Shell32.FolderItem
Set shApp = New Shell32.Shell
Set shFolder = shApp.NameSpace("FolderPath")
Set shFolderItem = shFolder.ParseName("Filename.zip")
Set shFolder2 = shFolderItem.GetFolder
For Each shFolderItem2 In shFolder2.Items
    Debug.Print shFolderItem2.Name
Next shFolderItem2

combo
 
Thanks combo. Have a purple star. :)

Is there any way of doing it without unzipping the file?

Ed Metcalfe.

Please do not feed the trolls.....
 
The code does not unzip archive. I assumed that the explorer can access it (shFolderItem.GetFolder).

combo
 
>without unzipping the file?

The code presented (which we've covered in reasonable detail over in the VB5/VB6 forum) does not unzip anything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top