Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Extract a single file from a Compressed Folder (Zip file)

Hi guys

Given a certain criteria in a filename, I would like to
programmatically extract a single file from a zip file (compressed
folder) that may have one or many files in it. Can someone point me
in the right direction?

Thanks in advance

Paul Martin
Melbourne, Australia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Extract a single file from a Compressed Folder (Zip file)

Hi Paul

See the commented text in the first macro
http://www.rondebruin.nl/windowsxpunzip.htm


--

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


"Paul Martin" wrote in message ...
Hi guys

Given a certain criteria in a filename, I would like to
programmatically extract a single file from a zip file (compressed
folder) that may have one or many files in it. Can someone point me
in the right direction?

Thanks in advance

Paul Martin
Melbourne, Australia

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Extract a single file from a Compressed Folder (Zip file)

Thanks for the response, Ron. That looks like it might do what I want
it to, though it'll be a while before I can try it.

Paul


On Sep 16, 1:06 pm, "Ron de Bruin" wrote:
Hi Paul

See the commented text in the first macrohttp://www.rondebruin.nl/windowsxpunzip.htm

--

Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm

"Paul Martin" wrote in ...
Hi guys


Given a certain criteria in a filename, I would like to
programmatically extract a single file from a zip file (compressed
folder) that may have one or many files in it. Can someone point me
in the right direction?


Thanks in advance


Paul Martin
Melbourne, Australia


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Extract a single file from a Compressed Folder (Zip file)

Thanks Ron, that's working just fine. I'm using the line code you
commented out to select a specific file.

Paul


On Sep 16, 2:41 pm, Paul Martin wrote:
Thanks for the response, Ron. That looks like it might do what I want
it to, though it'll be a while before I can try it.

Paul

On Sep 16, 1:06 pm, "Ron de Bruin" wrote:

Hi Paul


See the commented text in the first macrohttp://www.rondebruin.nl/windowsxpunzip.htm


--


Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm


"Paul Martin" wrote in ...
Hi guys


Given a certain criteria in a filename, I would like to
programmatically extract a single file from a zip file (compressed
folder) that may have one or many files in it. Can someone point me
in the right direction?


Thanks in advance


Paul Martin
Melbourne, Australia


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Extract a single file from a Compressed Folder (Zip file)

I've been using the below code with success, but now it's failing at
oApp.Namespace(TEMP_FOLDER).CopyHere. I get a Windows (not VBA) error
saying "the file exists." The temp folder is in fact empty. Any
suggestions?

Private Sub LoopThruFileItems(ByVal varZipFullPath As Variant)
Dim oApp As Object
Dim objFile As Object
Dim strCSVFullPath As String

Set oApp = CreateObject("Shell.Application")
TEMP_FOLDER = Environ("USERPROFILE") & "\Desktop\TEMP\"

For Each objFile In oApp.Namespace(varZipFullPath).Items
If Left(objFile.Name, 6) = "int140" Then
' Copy required file item from zip to temp folder
oApp.Namespace(TEMP_FOLDER).CopyHere _
oApp.Namespace(varZipFullPath).Items.Item(objFile. Name)

' Extract data, then delete the file item extracted from
the zip file
strCSVFullPath = TEMP_FOLDER & objFile.Name
ExtractData strCSVFullPath
Workbooks(objFile.Name).Close False
Kill strCSVFullPath
End If
Next objFile
End Sub





On Sep 17, 9:55*am, Paul Martin wrote:
Thanks Ron, that's working just fine. *I'm using the line code you
commented out to select a specific file.

Paul

On Sep 16, 2:41 pm, Paul Martin wrote:

Thanks for the response, Ron. *That looks like it might do what I want
it to, though it'll be a while before I can try it.


Paul


On Sep 16, 1:06 pm, "Ron de Bruin" wrote:


Hi Paul


See the commented text in the first macrohttp://www.rondebruin.nl/windowsxpunzip.htm


--


Regards Ron de Bruinhttp://www.rondebruin.nl/tips.htm


"Paul Martin" wrote in ...
Hi guys


Given a certain criteria in a filename, I would like to
programmatically extract a single file from a zip file (compressed
folder) that may have one or many files in it. *Can someone point me
in the right direction?


Thanks in advance


Paul Martin
Melbourne, Australia


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
Capture data in one 'destination' file from varied 'source' file stored in one single folder. Smits Excel Programming 4 October 7th 06 12:35 PM
Extract file names from folder Haraki Excel Programming 5 August 24th 06 09:12 PM
I can't open an xls.file compressed(zipped)folder in Windows XP? Kadi Excel Discussion (Misc queries) 0 November 16th 05 04:51 PM
Saving file to compressed folder Claude Excel Programming 2 October 7th 04 07:07 PM
Extract file names last save info from a Folder Harapa Excel Programming 0 November 16th 03 04:33 PM


All times are GMT +1. The time now is 01:50 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"