Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
I have a bunch of .zip folders that I created by manually using the
built in Windows XP 'Compress (zipped) Folder' option under the 'Send To' item on the pop-up menu associated with the folder to be compressed. Each zipped folder contains a lot of files, but I'm only interested in a handful from each, thus I'm wasting a lot of time waiting for the entire folder to unzip. Is there a way to specify that I only want to unzip certain files, such as *.txt files? I use the .Namespace property (oApp.Namespace(DefPath).CopyHere oApp.Namespace(Fname).items), but I can't find any documentation for it. I don't have any other zip utilities to use, nor can I put them on my machine. Thanks, Tom D |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
Hi Tom
You can use this to get one file oApp.Namespace(Fname).items.item("test.txt") Maybe you can loop through the files and test the extension I have no time to tes it for you now -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tom D" wrote in message ... I have a bunch of .zip folders that I created by manually using the built in Windows XP 'Compress (zipped) Folder' option under the 'Send To' item on the pop-up menu associated with the folder to be compressed. Each zipped folder contains a lot of files, but I'm only interested in a handful from each, thus I'm wasting a lot of time waiting for the entire folder to unzip. Is there a way to specify that I only want to unzip certain files, such as *.txt files? I use the .Namespace property (oApp.Namespace(DefPath).CopyHere oApp.Namespace(Fname).items), but I can't find any documentation for it. I don't have any other zip utilities to use, nor can I put them on my machine. Thanks, Tom D |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
Ron de Bruin wrote:
Hi Tom You can use this to get one file oApp.Namespace(Fname).items.item("test.txt") Maybe you can loop through the files and test the extension I have no time to tes it for you now Ron, Okay, this works: "oApp.Namespace(A).CopyHere oApp.Namespace(B).items.item("subdirectory/test.txt")" Is there a way to list the zip contents (I've tried several things that didn't work)? I don't have a listing of the *.txt files. Thanks, Tom D |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
Hi Tom
I have time tomorrow to play with it I will see if I can find a good way -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tom D" wrote in message ... Ron de Bruin wrote: Hi Tom You can use this to get one file oApp.Namespace(Fname).items.item("test.txt") Maybe you can loop through the files and test the extension I have no time to tes it for you now Ron, Okay, this works: "oApp.Namespace(A).CopyHere oApp.Namespace(B).items.item("subdirectory/test.txt")" Is there a way to list the zip contents (I've tried several things that didn't work)? I don't have a listing of the *.txt files. Thanks, Tom D |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
Hi Tom
Test this one for me Sub Unzip1() Dim FSO As Object Dim oApp As Object Dim fname Dim FileNameFolder Dim DefPath As String Dim strDate As String Dim f fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _ MultiSelect:=False) If fname = False Then 'do nothing Else DefPath = Application.DefaultFilePath If Right(DefPath, 1) < "\" Then DefPath = DefPath & "\" End If strDate = Format(Now, " dd-mm-yy h-mm-ss") FileNameFolder = DefPath & "MyUnzipFolder " & strDate & "\" 'Create normal folder MkDir FileNameFolder Set oApp = CreateObject("Shell.Application") 'Copy the files in the newly created folder For Each f In oApp.Namespace(fname).items If f Like "*.txt" Then oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items.Item(CStr(f)) End If Next MsgBox "You find the files he " & FileNameFolder On Error Resume Next Set FSO = CreateObject("scripting.filesystemobject") FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True Set oApp = Nothing Set FSO = Nothing End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Tom I have time tomorrow to play with it I will see if I can find a good way -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tom D" wrote in message ... Ron de Bruin wrote: Hi Tom You can use this to get one file oApp.Namespace(Fname).items.item("test.txt") Maybe you can loop through the files and test the extension I have no time to tes it for you now Ron, Okay, this works: "oApp.Namespace(A).CopyHere oApp.Namespace(B).items.item("subdirectory/test.txt")" Is there a way to list the zip contents (I've tried several things that didn't work)? I don't have a listing of the *.txt files. Thanks, Tom D |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Unzip specific files with .Namespace?
Hi Tom
I update(add, the unzip page was a txt file first) both pages today If you have problems let me know Zip file or files with the default Windows zip program (VBA) http://www.rondebruin.nl/windowsxpzip.htm Unzip file or files with the default Windows zip program (VBA) http://www.rondebruin.nl/windowsxpunzip.htm -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Tom Test this one for me Sub Unzip1() Dim FSO As Object Dim oApp As Object Dim fname Dim FileNameFolder Dim DefPath As String Dim strDate As String Dim f fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _ MultiSelect:=False) If fname = False Then 'do nothing Else DefPath = Application.DefaultFilePath If Right(DefPath, 1) < "\" Then DefPath = DefPath & "\" End If strDate = Format(Now, " dd-mm-yy h-mm-ss") FileNameFolder = DefPath & "MyUnzipFolder " & strDate & "\" 'Create normal folder MkDir FileNameFolder Set oApp = CreateObject("Shell.Application") 'Copy the files in the newly created folder For Each f In oApp.Namespace(fname).items If f Like "*.txt" Then oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items.Item(CStr(f)) End If Next MsgBox "You find the files he " & FileNameFolder On Error Resume Next Set FSO = CreateObject("scripting.filesystemobject") FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True Set oApp = Nothing Set FSO = Nothing End If End Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... Hi Tom I have time tomorrow to play with it I will see if I can find a good way -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Tom D" wrote in message ... Ron de Bruin wrote: Hi Tom You can use this to get one file oApp.Namespace(Fname).items.item("test.txt") Maybe you can loop through the files and test the extension I have no time to tes it for you now Ron, Okay, this works: "oApp.Namespace(A).CopyHere oApp.Namespace(B).items.item("subdirectory/test.txt")" Is there a way to list the zip contents (I've tried several things that didn't work)? I don't have a listing of the *.txt files. Thanks, Tom D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Problem using obj.Namespace(sourceFileName) Namespace(DestinationFilename).Itemsand then opening the xls file which creates a Temp Folder inside Temp | Excel Discussion (Misc queries) | |||
zip/unzip excel files | Excel Discussion (Misc queries) | |||
unzip/zip xlsx files | Excel Discussion (Misc queries) | |||
Want to Unzip files automatically | Excel Programming | |||
Batch files auto unzip | Excel Programming |