Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default Delete file within a zip file

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete file within a zip file

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message ...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message ...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

I'm using XP - a series of posts on the subject of MoveHere suggested that
there is a problem with the XP implementation of the Shell object. In
addition, it appears to totally ignore the intOptions parameter.

"Kevin Beckham" wrote:

Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message ...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete file within a zip file

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message ...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

Your code works fine until I change FileNameZip from Variant to String, then
it fails
i.e. change
Dim FName, vArr, FileNameZip
to
Dim FName, vArr, FileNameZip As String

Kevin

"Ron de Bruin" wrote:

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message ...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham





  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete file within a zip file

That's correct it must be a variant



--

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




"Kevin Beckham" wrote in message ...
Your code works fine until I change FileNameZip from Variant to String, then
it fails
i.e. change
Dim FName, vArr, FileNameZip
to
Dim FName, vArr, FileNameZip As String

Kevin

"Ron de Bruin" wrote:

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message
...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham






  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Delete file within a zip file

I add a note on both pages now that you must use a variant

--

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




"Ron de Bruin" wrote in message ...
That's correct it must be a variant



--

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




"Kevin Beckham" wrote in message
...
Your code works fine until I change FileNameZip from Variant to String, then
it fails
i.e. change
Dim FName, vArr, FileNameZip
to
Dim FName, vArr, FileNameZip As String

Kevin

"Ron de Bruin" wrote:

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message
...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham









  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Delete file within a zip file

Or continue to declare it as a string, but use cVar() when you pass the parm.



Kevin Beckham wrote:

Your code works fine until I change FileNameZip from Variant to String, then
it fails
i.e. change
Dim FName, vArr, FileNameZip
to
Dim FName, vArr, FileNameZip As String

Kevin

"Ron de Bruin" wrote:

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message ...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham






--

Dave Peterson
  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Delete file within a zip file

Thanks Ron and Dave,
I'll add it to my list of things that "don't make sense but you just have to
know"

Kevin

"Kevin Beckham" wrote:

Your code works fine until I change FileNameZip from Variant to String, then
it fails
i.e. change
Dim FName, vArr, FileNameZip
to
Dim FName, vArr, FileNameZip As String

Kevin

"Ron de Bruin" wrote:

Hi Kevin

The code sample I posted run ok on VPC with Win Xp

Is the code on this page working for you ?
http://www.rondebruin.nl/windowsxpzip.htm

--

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




"Kevin Beckham" wrote in message ...
Thanks Ron, but a zip file doesn't behave like a normal folder. When you move
a file from it, the file remains behind - i.e. equivalent to a copy process.

I did encounter other unusual behaviour
'this code failed
Set oFolder = oApp.Namespace(sZipFile)
'this code worked
Set oFolder = oApp.Namespace("" & sZipFile)

irrespective of whether sZipFile is passed ByVal or ByRef

Kevin

"Ron de Bruin" wrote:

You can also use this to move it to the Temp folder or other folder

Dim oApp As Object
Set oApp = CreateObject("Shell.Application")

oApp.Namespace(Environ("Temp") & "\").MoveHere _
oApp.Namespace("C:\Users\Ron\Documents\ron.zip").i tems.Item("TestCodeTables.txt")

After that use Kill to delete the file

--

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




"Kevin Beckham" wrote in message
...
Thanks Patrick, but DeleteFile is part of FileSystemObject - your code would
delete the entire zip file, not a specific file within it

I eventually tracked down what was needed

oApp.Namespace(FileNameZip).items.Item _
(sFileToBeRemoved).InvokeVerb "&Delete"

will come up with the message that you about to permanently delete the file
and do you want to proceed.

The possible verbs are
&Open
Cu&t
&Copy
&Delete
P&roperties
for a file within a zip file (folder). It is probable that the ampersand
could be left out of the verb name.

Kevin

"Patrick Molloy" wrote:

the syntax is
DeleteFile {filename}


Option Explicit
Sub demo()
Dim sFilename As String
sFilename = "C:\test\somefile.zip"
DeleteFile sFilename
End Sub

"Kevin Beckham" wrote in message
...
With an existing zip file, how can I delete one of the zipped files ?

I can reference the file with something like
Set oApp = CreateObject("Shell.Application")
With oApp.Namespace(FileNameZip).Items.item(sFileToBeRe moved)

End With

but can't get the verb to use to be able to delete it.

I have tried using the code that accesses zip32.dll and unzip32.dll and,
while it will happily add and extract files from the zip file, it corrupts
the zip file when i try to delete one of its members.

Any help greatly appreciated
TIA
Kevin Beckham





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
2007 Macro to Open File, Delete Contents, Save New File Flintstone[_2_] Excel Discussion (Misc queries) 2 February 1st 10 11:25 PM
how do i delete a file from recent documents file in excel exile New Users to Excel 1 March 7th 09 01:59 AM
delete info from source file w/out changing the destination file TB New Users to Excel 0 May 26th 08 06:26 PM
excel file deleted. Now howdo you delete file NAME NANMAC New Users to Excel 8 September 2nd 05 07:26 AM
How do I Delete a file from the drop down file menu? Sander Excel Worksheet Functions 2 November 6th 04 05:05 PM


All times are GMT +1. The time now is 07:41 PM.

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"