Extract Zip file Using VB

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

Question by:anadim
    LVL 8

    Expert Comment

    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

    LVL 27

    Assisted Solution

    '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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    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…

    779 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now