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