This needs to work with both Windows 7 and Windows 10. I'm converting a clients very manual Excel VBA based process to something linking MS Access via ODBC to his Pervasive database backend of his MRP program.
I found another thread where they were using Access VBA to unzip a file, but I can't post to that site, even though I have a login account, so I'm posting here:
The code used in that link is as follows. I haven't run it yet. Was just wondering how to incorporate an encrypted password value to get the desired result:
Sub ImportZippedFile(ByVal sZipFileName As Variant)
Dim oApp As Object
Dim fileNameInZip As Variant
Dim sFileNameFolder As Variant
Dim vLocalZipName as Variant
vLocalZipName =sZipFileName
'use system temp folder to extract zipped file to.
sFileNameFolder = Environ("Temp") & "\Excel_Tmp\"
'Extract the file into the newly created folder
Set oApp = CreateObject("Shell.Application")
'list all the file names within the zip file
For Each fileNameInZip In oApp.Namespace(vLocalZipName ).items
msgbox filenameinzip
oApp.Namespace(sFileNameFolder).CopyHere _
oApp.Namespace(vLocalZipName ).items.item(CStr(fileNameInZip))
Next fileNameInZip
Set oApp = Nothing
End Sub
However, the zip file in that example was evidently not password protected. My client has a directory full of password protected zip files. He uses Excel VBA and a database table that has the file names, and the encrypted password needed to unzip the file. His code calls WinZip from an Excel VBA shell out, and supplies the encrypted password as a parameter to WinZip so it can unzip the file.
His current code uses Winzip under Windows 7. I'm on Windows 10, and when I installed Winzip on my machine, it froze up File Explorer, and I could not view my subdirectories or directories. When I uninstalled WInzip, all was good again.
what code would allow me to unzip a file, using only Access VBA, if I had an encrypted password?
The encrypted password was generated by his Sage MRP program.