1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| Sub DezipFichier()
UnzipAll "D:\Users\BrunoM45\Documents\Mes Docs EXCEL\Fichier.zip", "D:\Users\BrunoM45\Documents\Mes Docs EXCEL\"
End Sub
Function UnzipAll(ZipFile As String, Optional sDest As String = "") As String
On Error GoTo Error_UnzipAll
Dim oshell As Object
Dim oSrcFolder As Object
Dim oDestFolder As Object
Dim Itm As Object
Set oshell = CreateObject("Shell.Application")
Set oSrcFolder = oshell.Namespace(CVar(ZipFile))
Set oDestFolder = oshell.Namespace(CVar(sDest))
For Each Itm In oSrcFolder.items
oDestFolder.CopyHere Itm
Next Itm
UnzipAll = "OK"
Exit_UnzipAll:
Set Itm = Nothing
Set oSrcFolder = Nothing
Set oDestFolder = Nothing
Set oshell = Nothing
Exit Function
Error_UnzipAll:
UnzipAll = Err.Number & " " & Err.Description
Resume Exit_UnzipAll
End Function |
Partager