Extract Zip file Using VB

Posted on 2006-05-17
Medium Priority
Last Modified: 2012-05-05
How to extract a zip file (With a directory structure) using Visual Basic Code.

Question by:anadim

Expert Comment

ID: 16698247
i use winzip. they have a separate command line utillity you can download that works with winzip. it comes with documentation
LVL 14

Accepted Solution

MilanKM earned 252 total points
ID: 16699180
LVL 28

Assisted Solution

Ark earned 248 total points
ID: 16704563
'sSource - source zip file
'sDest - optional destination folder
'if omitted - application folder is using

Public Function vbExtractZIP(ByVal sSource As String, Optional ByVal sDest As String) As Boolean
   If sSource = "" Then Exit Function
   If Dir(sSource) = "" Then Exit Function
   If sDest = "" Then sDest = App.Path
   If Right(sDest, 1) <> "\" Then sDest = sDest & "\"
   Dim oShell As Object, oFolder As Object
   Set oShell = CreateObject("Shell.Application")
   Set oFolder = oShell.NameSpace(CVar(sDest))
   oFolder.CopyHere oShell.NameSpace(CVar(sSource)).Items
   Set oFolder = Nothing
   Set oShell = Nothing
   vbExtractZIP = True
End Function

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question