Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Unzip - multiple zips

Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Unzip - multiple zips

Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Unzip - multiple zips

Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John









  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

2 or 3 <g

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John











  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Unzip - multiple zips

On its way

John

"Ron de Bruin" wrote:

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John










  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

Nothing in my mailbox ?

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
On its way

John

"Ron de Bruin" wrote:

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John












  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

My test is OK when I duplicate your zip files a few times and select
the zip files with my macro.

Maybe others can test the code also with a few zip files

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Nothing in my mailbox ?

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
On its way

John

"Ron de Bruin" wrote:

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John
















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 173
Default Unzip - multiple zips

Hi Ron,
It worked perfectly.

I am so stupid - I changed the names of the zipped files and not the files
themselves hence the code only opened one file.
Many thanks for your help Ron
All the best
John




"Ron de Bruin" wrote:

My test is OK when I duplicate your zip files a few times and select
the zip files with my macro.

Maybe others can test the code also with a few zip files

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Nothing in my mailbox ?

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
On its way

John

"Ron de Bruin" wrote:

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John















  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Unzip - multiple zips

No Problem John

I add the example to my site
http://www.rondebruin.nl/windowsxpzip.htm

Maybe useful for others

Good night


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It worked perfectly.

I am so stupid - I changed the names of the zipped files and not the files
themselves hence the code only opened one file.
Many thanks for your help Ron
All the best
John




"Ron de Bruin" wrote:

My test is OK when I duplicate your zip files a few times and select
the zip files with my macro.

Maybe others can test the code also with a few zip files

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Ron de Bruin" wrote in message ...
Nothing in my mailbox ?

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
On its way

John

"Ron de Bruin" wrote:

Hi John

Is it possible that you send me 3 or three zip files private
Easier to test then for me

--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi Ron,
It does one file and then gets stuck in the loop. The files a

Generic Schedule Region 61 -306
Generic Schedule Region 62 -306
Generic Schedule Region 63 -306

and so on, if that helps

John
"Ron de Bruin" wrote:

Ok test this one for me John

Sub Unzip1_test()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
Dim strDate As String
Dim I As Long
Dim num As Long

fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", _
MultiSelect:=True)
If IsArray(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")

For I = LBound(fname) To UBound(fname)
num = oApp.NameSpace(FileNameFolder).items.Count

'Copy the files in the newly created folder
oApp.NameSpace(FileNameFolder).CopyHere oApp.NameSpace(fname(I)).items

On Error Resume Next
Do Until oApp.NameSpace(FileNameFolder).items.Count = num + oApp.NameSpace(fname(I)).items.Count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0

Next I

MsgBox "You find the files he " & FileNameFolder
Set oApp = Nothing
End If
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Wow - that was quick. Thanks for your help Ron.
That would be ideal
John

"Ron de Bruin" wrote:

Hi John

Do you want all zip files you select unzipped in the same folder ?


--
Regards Ron de Bruin
http://www.rondebruin.nl


"JohnUK" wrote in message ...
Hi,
I have this brilliant piece of code that I picked up from Ron de Bruin web
site, that unzips a file and saves as unzipped.
Sub Unzip()
Dim oApp As Object
Dim fname
Dim FileNameFolder
Dim DefPath As String
fname = Application.GetOpenFilename(filefilter:="Zip Files (*.zip),
*.zip", _
MultiSelect:=True)
' I changed the MultiSelect:=False to True hoping it would work
If fname = False Then
Else
sPath = Application.DefaultFilePath & "\Schedules\Unzipped"
DefPath = sPath
If Right(DefPath, 1) < "\" Then
DefPath = DefPath & "\"
End If
FileNameFolder = DefPath
Set oApp = CreateObject("Shell.Application")
oApp.Namespace(FileNameFolder).CopyHere oApp.Namespace(fname).items
MsgBox "Files can be found he " & FileNameFolder
Set oApp = Nothing
End If
End Sub
(Slightly changed for my setup) The problem I have is, it only unzips one
file at a time. Is there some way that the code can do a loop of sorts so
that it would pick up all the zipped files within a folder in one go and
unzip?
Again - help much appreciated
Regards
John

















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
How to merge Excel address columns when some zips begin with zeros LeoLady Excel Discussion (Misc queries) 4 December 17th 08 02:51 AM
zip/unzip excel files SHANTA MENON Excel Discussion (Misc queries) 3 July 30th 08 10:10 PM
Unzip fuction in excel Willy Excel Worksheet Functions 1 April 17th 08 12:49 AM
Purging ZIPCODES from a string of cities and zips Bruce Excel Worksheet Functions 7 November 27th 06 10:53 AM
Want to Unzip files automatically Hari[_3_] Excel Programming 1 January 14th 05 03:37 PM


All times are GMT +1. The time now is 09:02 AM.

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

About Us

"It's about Microsoft Excel"