-
Solved: copyhere method
Hi,
I've been writing some code on Excell VBA to copy particular file from a zip folder to a new folder using the following code bit
[vba]Set oApp = CreateObject("Shell.Application")
For Each fileNameInZip In oApp.Namespace(zipObj).items
zipExt = Right(fileNameInZip, 3)
Zipfilename = Mainfilename(fileNameInZip)
If Zipfilename Like DFTFile Then
'Copy the DFT file to DFT Files Folder
oApp.Namespace(FileNameFolder).CopyHere (fileNameInZip)
'Rename the DFT file as TXT file
'Name FileNameFolder & fileNameInZ being copied alreadyip As FileNameFolder & DFTFile & ".txt"
'Copy the DFT file to the Archive Folder
oApp.Namespace(DFTArchiveFolder & fnm).CopyHere (fileNameInZip)
End If
Next
'Delete the store zip file from ZIP files folder
Kill (zipObj)[/vba]
sometimes the new folder has the files with the same file name that are extracted from the zip file. I need these files to overwrite the existing files without pressing "yes to All".
I tried using
[vba]oApp.Namespace(DFTArchiveFolder & fnm).CopyHere (fileNameInZip) FOF_NONCONFIRMATION[/vba]
with FOF_NONCONFIRMATION defined as a constant 16. But still it keeps asking for input to overwrite.
can someone pls help me to fix this?
-
Maybe check to see if the unzip file name exists before you unzip and if it does Kill it? Dave
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules