Using VBA to Program Open XML Files : Shell « Windows API « VBA / Excel / Access / Word






Using VBA to Program Open XML Files

 
Sub UnzipPackage()
         Dim o As Object
         Dim TargetFile, NewFileName, DestinationFolder, ofile
         TargetFile = ThisWorkbook.Path & "\SalesByPeriod.xlsx"
         NewFileName = TargetFile & ".zip"
         FileCopy TargetFile, NewFileName
         DestinationFolder = "C:\MyUnzipped"
              On Error Resume Next
              MkDir (DestinationFolder)
         Set o = CreateObject("Shell.Application")
             For Each ofile In o.Namespace(NewFileName).items

             o.Namespace(DestinationFolder).CopyHere (ofile)
         Next ofile
         Kill NewFileName
         Set o = Nothing
     End Sub

 








Related examples in the same category

1.Creates a text files and saves it
2.Returning the Task ID of the Started Application
3.SendKeys to another application
4.Starting Another Application
5.Having Excel dial the phone, one key at a time