PDA

View Full Version : [SOLVED] Tricks with Zips



GreenTree
06-02-2007, 04:18 PM
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.

mdmackillop
06-03-2007, 01:43 AM
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 (http://www.winzip.com/downcl.htm) 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.

Bob Phillips
06-03-2007, 02:08 AM
Take a look here (http://www.rondebruin.nl/zip.htm)