Last active
March 10, 2019 12:18
-
-
Save ezhov-da/8773d1749c39aabeccc6e5a1f6f4c9b5 to your computer and use it in GitHub Desktop.
vba разархивирование файла.vba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function UnZip_File(ByVal FileNameZip, ByVal DestinationFolder, _ | |
Optional ByVal DeleteSourceFile As Boolean = False) As Boolean | |
On Error Resume Next: Err.Clear | |
If Right(DestinationFolder, 1) <> "\" Then DestinationFolder = DestinationFolder & "\" | |
MkDir DestinationFolder | |
If Len(Dir(DestinationFolder, vbDirectory)) = 0 Then Exit Function | |
If Len(Dir(FileNameZip)) = 0 Then MsgBox "Файл """ & FileNameZip & """ не найден", _ | |
vbCritical, "Ошибка в функции UnZip_File": Exit Function | |
Set oApp = CreateObject("Shell.Application") | |
For Each it In oApp.Namespace(FileNameZip).Items: Debug.Print it: Next | |
oApp.Namespace(DestinationFolder).CopyHere oApp.Namespace(FileNameZip).Items | |
If DeleteSourceFile Then Kill FileNameZip | |
UnZip_File = Err = 0 | |
End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment