Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default How to open a zip file and extract its contents in a macro?

Hi
I need to save space in my hard disk so i have to zip some files, but i need
them for consulting values and make some reports, i need to run a macro that
opens the zip file, extract the workbook copy some values from it and then
close it without making changes, and close the zip file.
The zip file and the workbook have the same name.
This operation is done by hand 5 times everyday so you'll understand my
need.
Please any help is needed


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default How to open a zip file and extract its contents in a macro?

Hard drive space is pretty cheap nowadays. It might be easier just investing a
few bucks into a larger HD.

But there are command line versions of the unzipping programs. (I think PKZip
(www.pkzip.com) has a version.)

You could use a shellandwait routine to unzip the file.
http://support.microsoft.com/?kbid=214248
XL2000: How to Force Macro Code to Wait for Outside Procedure

Here's a link to a nice ShellAndWait function that does that.
http://groups.google.com/groups?thre...%40tkmsftngp03

Then open that workbook, copy the data you want, close without saving and kill
the file.

dim wkbk as workbook
set wkbk = workbooks.open(filename:=whateveryouextracteditto)
wkbk.worksheets("sheet1").range("b1:C99").copy _
destination:= thisworkbook.worksheets("sheet99").range("x7")
wkbk.close savechanges:=false
kill whateveryouextracteditto


might give you an idea.



"Audie G. Bencosme R." wrote:

Hi
I need to save space in my hard disk so i have to zip some files, but i need
them for consulting values and make some reports, i need to run a macro that
opens the zip file, extract the workbook copy some values from it and then
close it without making changes, and close the zip file.
The zip file and the workbook have the same name.
This operation is done by hand 5 times everyday so you'll understand my
need.
Please any help is needed


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Excel file from VB and open MACRO no1jimmyman Excel Discussion (Misc queries) 0 February 14th 11 10:10 PM
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
How to save file in a macro taking new name from cell contents? LowIQ Excel Discussion (Misc queries) 3 May 31st 06 10:52 PM
Macro to extract clip-art file? Terry Pinnell Excel Discussion (Misc queries) 0 February 11th 05 08:56 AM
Automate open file, update links, run macro, close and save file Geoff[_7_] Excel Programming 2 August 26th 03 10:13 PM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"