
Originally Posted by
OlsonSound
This seems to work:
Bruce
Not quite... Zipfiles function drops last file to be zipped from pszToZip() array.
Code:
If UBound(pszToZip) > 0 Then
ReDim pidlToZip(UBound(pszToZip) - 1) 'Array is redimensioned, so last file dropped.
For q = 0 To UBound(pszToZip) - 1 'Yet again here errorneously? counted one file less, but somehow seems to work**.
pidlToZip(q) = ILCreateFromPathW(StrPtr(pszToZip(q)))
Next
End If
Code:
**
ReDim Preserve sFilenames(UBound(sFilenames) + 1) 'Note workaround... must add additional empty file, otherwise last file dropped.
ZipFiles sFilename & ".zip", sFilenames()
Code:
'Modified code... This does not work either. ***
If UBound(pszToZip) > 0 Then
' ReDim pidlToZip(UBound(pszToZip) - 1) 'Line commented out
For q = 0 To UBound(pszToZip) 'Corrected? -> but now causes out of bounds error.
pidlToZip(q) = ILCreateFromPathW(StrPtr(pszToZip(q)))
Next
End If
Code:
***
'Call without additional empty array position.
ZipFiles sFilename & ".zip", sFilenames()
So has anybody idea, why redimensioning is needed in the first place?