So here's basically what's going on:
1. I'm using the Winzip command line utility, wzunzip to extract Excel files from Zip files
2. I then want to remove the .zip file once the .xls file is in the folder.
My problem comes in when I'm using the FileDialog to specify the files, and telling it to delete the same file it just extracted from. Logically, I cannot see why it's deleting both the .zip file as well as the .xls file.
So here's a bit of the code where the issue is occurring:
I've tested, and I know for 100% certain the Unzip piece is working 100% correctly. So why is the Kill command removing anything that LOOKS like the same file name, apparently??
Any thoughts?
Thanks
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
1. I'm using the Winzip command line utility, wzunzip to extract Excel files from Zip files
2. I then want to remove the .zip file once the .xls file is in the folder.
My problem comes in when I'm using the FileDialog to specify the files, and telling it to delete the same file it just extracted from. Logically, I cannot see why it's deleting both the .zip file as well as the .xls file.
So here's a bit of the code where the issue is occurring:
Code:
Dim fd As FileDialog
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim i As Variant
Set db = CurrentDb
Set rs = db.OpenRecordset("tblProjectPath")
Set fd = FileDialog(msoFileDialogFilePicker)
fd.AllowMultiSelect = True
fd.Title = "Select TOC Return File(s) to process"
fd.InitialFileName = rs.Fields("ProjectPath") & "\FilingReports\*.zip"
fd.Show
For Each i In fd.SelectedItems
'Debug.Print i
Debug.Print '------------------------'
Debug.Print i
Unzip (i) 'The bit calling the command line unzip utility to unzip the file - just telling it to extract all files to the current folder.
Debug.Print i
'Kill i
'had to take out the kill bit, b/c it was deleting both the .zip and .xls files which is not desired nor expected
If InStr(i, ".zip") Then
Kill i 'Tried to specify only .zip files even though think I shouldn't need to, but it's still deleting .xls files
End If
Next i
I've tested, and I know for 100% certain the Unzip piece is working 100% correctly. So why is the Kill command removing anything that LOOKS like the same file name, apparently??
Any thoughts?
Thanks
"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57