' The purpose of this code is to locate and unzip a file then save the
' newly created, unzipped file over top of a file with the same name.
Sub UNZIPandSAVEAS()
Dim FSO As Object
Dim oApp As Object
Dim Fname As Variant
Dim NewFile As Variant
Dim DefPath As String
Dim strDate As String
Fname = "C:\Users\Steve\ftp\DOWBUFF.zip"
'Root folder for unzipped file
DefPath = "C:\Users\Steve\ftp\UnzippedBUFFS\"
NewFile = DefPath ' Variant
'Extract the file into the newly created location
Set oApp = CreateObject("Shell.Application")
' Copy the newly unzipped file to the new location (Save - As)
oApp.Namespace(NewFile).CopyHere oApp.Namespace(Fname).items
' Close temporary file
On Error Resume Next
Set FSO = CreateObject("scripting.filesystemobject")
FSO.deletefolder Environ("Temp") & "\Temporary Directory*", True
End Sub
Bookmarks