The files are unzipped into a dated sub folder of strPath. You can unzip them into strPath without the sub folder by changing the UnZipFile macro as below. Whether I would recommend that is another issue entirely. It rather depends on the object of the exercise.
Note also there is a typo in the UnzipAttachments macro.
should beIf Not FileExists(strPath) Then MkDir strPath
If Not FolderExists(strPath) Then MkDir strPathPrivate Sub UnZipFile(Fname As Variant, strPath As String) Dim FSO As Object Dim oShell As Object Dim FileNameFolder As Variant 'Dim strDate As String 'Const strSubFolder As String = "Unzip" 'Create the folder name 'strDate = Format(Now, " dd-mm-yy") FileNameFolder = strPath '& strSubFolder & strDate & "\" 'Make the normal folder in DefPath 'MkDir FileNameFolder 'Extract the files into the newly created folder Set oShell = CreateObject("Shell.Application") oShell.NameSpace(FileNameFolder).CopyHere oShell.NameSpace(Fname).Items 'MsgBox "You find the unzipped file(s) here: " & FileNameFolder On Error Resume Next Set FSO = CreateObject("scripting.filesystemobject") FSO.DeleteFolder Environ("Temp") & "\Temporary Directory*", True lbl_Exit: Set FSO = Nothing Set oShell = Nothing Exit Sub End Sub




Reply With Quote
