Zip with the default Windows XP zip program

Hi all

On my site I have code to zip/unzip with WinZip, but many people asked me if it is not possible
to do the same with the default Windows XP zip program.
Finally I found a way with VBA to zip with the default Windows XP zip program.

I add this page to my site with a few examples.
http://www.rondebruin.nl/windowsxpzip.htm

Have fun with it

Regards Ron de Bruin
http://www.rondebruin.nl

Posted in Uncategorized

7 thoughts on “Zip with the default Windows XP zip program

  1. Hi all

    I update the site with a new macro that create the empty zip file, this code suggestion is from keepITcool.
    And I add Wait code in the second and third sub

  2. I am using this code in an Outlook program and so far it works great(thanks). Is there a parameter or additional code that will let me check the datetimestamp of the items in the zip file. I want to make sure that I don’t replace a newer file when I execute the .CopyHere code. Thanks

  3. Hi Jim

    With normal folders this is no problem but with
    a zip folder it is different.

    I will check it out this weekend (bed time for me now).
    I want to update the page also with new code soon

  4. Ron,

    I know this is a very old thread, but I was hoping for some help.

    I maintain a master workbook which contains several worksheets I maintain and distibute. I have a several VBA modules, in the master, that I use to support this. The master contains the latest and greatest worksheets and VBA modules. Distribution involves programatically creating a new workbook, copying the desired worksheet to it, and copying a subset of VBA modules to it. I have recently started using a custom ribbon and would like to copy that to the distributed workbooks as well.

    Because ZIPPING/UNZIPPING using CopyHere has rules about overwriting files/folder I am doing the following:
    – Unzipping the target Excel workbook into a work folder
    – Removing the _rels and customui subfolders from the work folder
    – Unzipping the _rels and customUI folders from the master into the work folder
    – Creating a new blank ZIP
    – Zipping the work folder into the new blank ZIP
    – Deleting the work folder

    The problem I am having is my task fails occasionally when deleteing the work folder. The wait loops seem to work for the unzipping but not the zipping. The wait loop is counting the entries in the top level folder and I believe my files are being written before the subfolders. Since the subfolders are created they count when checking the entries and the wait loop exits. BTW, do you know how to use namespace to count all files in a folder tree?

    Also, I’ve been playing around using oApp.namespace(FolderName).self.size to monitor when a folder stops growing. Not the greatest method since system loads could possibly cause delays in updating the size and small files might not increment the size. But this is what I have been trying. Do you see any issues?

    oldSize = 0
    Do While oApp.Namespace(FolderName).self.Size oldSize
    oldSize = oApp.Namespace(FolderName).self.Size
    Application.Wait Now() + TimeValue(“00:00:01”)
    Loop

    Thanks,
    Steve


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published. Required fields are marked *