oseitutuSamuel
Board Regular
- Joined
- Jul 31, 2015
- Messages
- 82
Hello Guys,
I have a VBA code that unzips the files in a folder. I wish to modify the code so that existing files will automatically be overwritten (without the prompt to confirm).
Any help will be greatly appreciated. Below is the existing code:
Sub UnzipFiles
Dim ShellApp As Object
Dim TargetFile
Dim ZipFolder
TargetFile = "C:\FolderContainingFiles"
ZipFolder = "C:\FolderToReceiveFiles"
MkDir ZipFolder
On Error GoTo ErrorOccurred
' copy the zipped files to the newly created folder
Set ShellApp = CreateObject("Shell.Application")
ShellApp.Namespace(ZipFolder).copyhere _
ShellApp.Namespace(TargetFile).items
MsgBox "The file was unzipped to:" & _
vbNewLine & ZipFolder & vbNewLine & vbNewLine, vbInformation, Installation
intNumOfLicenses = intNumOfLicenses - 1
Sheet1.Cells(1, 1).Value = intNumOfLicenses
End Sub
I have a VBA code that unzips the files in a folder. I wish to modify the code so that existing files will automatically be overwritten (without the prompt to confirm).
Any help will be greatly appreciated. Below is the existing code:
Sub UnzipFiles
Dim ShellApp As Object
Dim TargetFile
Dim ZipFolder
TargetFile = "C:\FolderContainingFiles"
ZipFolder = "C:\FolderToReceiveFiles"
MkDir ZipFolder
On Error GoTo ErrorOccurred
' copy the zipped files to the newly created folder
Set ShellApp = CreateObject("Shell.Application")
ShellApp.Namespace(ZipFolder).copyhere _
ShellApp.Namespace(TargetFile).items
MsgBox "The file was unzipped to:" & _
vbNewLine & ZipFolder & vbNewLine & vbNewLine, vbInformation, Installation
intNumOfLicenses = intNumOfLicenses - 1
Sheet1.Cells(1, 1).Value = intNumOfLicenses
End Sub