How to suppress message 'Confirm File Overwrite'

H

hi_bonjour

Hi,
I am trying to unzip a file in vba using the following piece of code.
But I get the message 'Confirm File Overwrite' ( I guess from winzip)
the files already exist.
Is there a way to suppress this message?

*******************************************8
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 PROCESS_QUERY_INFORMATION = &H400
Public Const STILL_ACTIVE = &H103
Public myZipfile As String



Public Sub ShellAndWait(ByVal PathName As String, Optional WindowState)
Dim hProg As Long
Dim hProcess As Long, ExitCode As Long
'fill in the missing parameter and execute the program
If IsMissing(WindowState) Then WindowState = 1
hProg = Shell(PathName, WindowState)
'hProg is a "process ID under Win32. To get the process handle:
hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, False, hProg)
Do
'populate Exitcode variable
GetExitCodeProcess hProcess, ExitCode
DoEvents
Loop While ExitCode = STILL_ACTIVE
End Sub




Sub ofUnzipFiles(ByVal srcFile As String, ByVal dstFolder As String)
Dim PathWinZip As String
Dim ShellStr As String


PathWinZip = "C:\program files\winzip\"
'This will check if this is the path where WinZip is installed.
If Dir(PathWinZip & "winzip32.exe") = "" Then
MsgBox "Please find your copy of winzip32.exe and try again"
Exit Sub
End If


'Unzip the zip file in the folder FolderName
ShellStr = PathWinZip & "Winzip32 -min -e" _
& " " & Chr(34) & srcFile & Chr(34) _
& " " & Chr(34) & dstFolder & Chr(34)
ShellAndWait ShellStr, 6
MsgBox "The file is extracted ."
End Sub



*********************************************

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top