Consulting

Results 1 to 3 of 3

Thread: Tricks with Zips

  1. #1
    VBAX Regular
    Joined
    Jan 2007
    Location
    Dallas area
    Posts
    74
    Location

    Tricks with Zips

    Four things I'd like to do from within Excel VBA, all with file and directory names defined by variables.

    First, knowing the file name & location of a file, with the name xxxx.555, I need to rename it to xxxx.zip. (it is a .zip file, although for goofy reasons, I get it with the .555 extension, so I need to rename it)

    Second, I need to extract the contents of that .zip file, and third, move the extracted files into a particular directory, again defined by variables. (If it's any help, the .zip file will always contain two files, with predictable names.)

    Fourth, I need to zip a group of files into a new .zip archive. Either turn ABC.xls into ABC.zip, or ABC.html and DEF.html and GHI.html into A2I.zip.

    I'm guessing that these tasks can be done from within Excel VBA, although I'm not clear on how. If there is a good tutorial or discussion about this out there some place, that would be much appreciated.

    Thanks,

    G.T.

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Greentree
    You will need to do this using the Zip programme, eg WinZip. If you go to their website you can download their command line support This will allow you to use the Shell command in VBA to run winzip and carry out the required actions. Note: there are probably free utililities as well.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Take a look here

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •