How do I implement Zip functionality in VBA?
I recently worked on an application in vba that relies on some files that are contained in the .docm file of the document itself. In the beginning, I used Windows functionality for compressed folders to programmatically extract the contents of a document. This was the optimal solution because it is built into every Windows XP that will be used and does not require installation. However, I fell into a trap: it seems that after I have extracted docm a certain number of times, it starts to crash, saying "Error, this file already exists". At first I thought I broke something and dug a little deeper, it turns out there was no bug in my code, but rather a bug in the compressed folder.
If you get a "File Already Exists" message on a specific zip file on your system, the compressed folder no longer works with any file with the same name, if you rename the specified file it will start working again. So here's my question: How can I implement zip capabilities in VBA without compressed folders? Bonus question: how can I fix compressed folders?
Thank you for your time.
-Seamus
Update: I am currently working using compressed folders, I am working on a bug by renaming the file to something new every time the error occurs. This works fine, but I'm looking for a fix rather than a hack.
a source to share
Perhaps the idea behind the bonus question: Can't you rename the file 2 times before using it in your VBA application? First give it a temporary name and then rename it back to its original name.
EDIT: I'm just guessing, but it's unlikely to be able to fix this issue from your application, but rather fix it as a kind of Windows patch. This means that every computer that will run your application will need to install this patch in order for it to work properly. And this is not something you can rely on. So I think you should stick with the workaround.
a source to share