- vba unzip multiple files
- excel vba zip multiple files
- extract zip file using excel vba
- macro to unzip all files in a folder
Function entUnZip1File(ByVal strZipFilename, ByVal strDstDir, ByVal strFilename)
Const glngcCopyHereDisplayProgressBox = 256
Dim intOptions, objShell, objSource, objTarget
Set objShell = CreateObject("Shell.Application")
Set objSource = objShell.Namespace(strZipFilename).Items.Item(CStr(strFilename))
Set objTarget = objShell.Namespace(strDstDir)
intOptions = glngcCopyHereDisplayProgressBox
objTarget.CopyHere objSource, intOptions
Set objSource = Nothing
Set objTarget = Nothing
Set objShell = Nothing
entUnZip1File = 1
End Function
Sub
entUnZip1File "PermanentDirectoryOfZippedFile" & VariableZippedFolderName & ".zip", "DirectoryToSaveExtractionFile", "FileNameToExtract.dat"
''' repeat this code if you have many files
end Sub
Note:
- The zipped file is located in PermanentDirectoryOfZippedFile\VariableZippedFolderName. For example C:\Users\YourUserName\Desktop\2017-06-01 where C:\Users\YourUserName\Desktop is permanent path and 2017-06-01 is variable folder with daily changes
- The zipped file name is FileNameToExtract.dat
- Location that you want to save unzipped or extracted file is DirectoryToSaveExtractionFile
Steps:
- Replace the text highlighted in yellow with your needs
- Done
No comments:
Post a Comment