Bonjour à toutes et à tous (à nouveau),
Voilà, j'aimerais pouvoir dézipper automatiquement un ficher zip. Mais je n'y arrive pas.
Le code, que j'essaie de faire fonctionner ne fait que m'ouvrir le logiciel 7-zip mais ne fait rien de plus à part courir.
Est-ce que quelqu'un pourrait-il me venir en aide?
Merci,
Marion
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Const STILL_ACTIVE = &H103
Public Const PROCESS_QUERY_INFORMATION = &H400
Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Declare Function GetExitCodeProcess Lib "kernel32" (ByVal hProcess As Long, lpExitCode As Long) As Long
Public Const STILL_ACTIVE = &H103
Public Const PROCESS_QUERY_INFORMATION = &H400
Public Sub ShellAndWait(ByVal PathName As String, Optional WindowState)
Dim hProg As Long
Dim hProcess As Long, ExitCode As Long
If IsMissing(WindowState) Then WindowState = 1
hProg = Shell(PathName, WindowState)
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, hProg)
Do
GetExitCodeProcess hProcess, ExitCode
DoEvents
Loop While ExitCode = STILL_ACTIVE
End Sub
Sub Dezipper()
Dim CheminZip As String
Dim DossierUnZip As String
Dim FichierZip As Variant, ShellStr As String
CheminZip = "C:\program files\7-Zip\"
DossierUnZip = "C:\Users\scmario\Desktop\Images\"
FichierZip = "C:\Users\scmario\Desktop\Images\data.zip"
ShellStr = CheminZip & "7z.exe x -aoa -r" _
& " " & Chr(34) & FichierZip & Chr(34) _
& " -o" & Chr(34) & DossierUnZip & Chr(34) & " " & "*.*"
ShellAndWait , ShellStr, vbHide
End Sub