With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.
Private Sub Command0_Click() Set objFSO = CreateObject("Scripting.FileSystemObject") 'Create instance of FSO Compress ("C:\FolderA") Set objFSO = Nothing End Sub Sub Compress(fil) Dim strPath, strExt, strfile As String strPath = Left(fil, InStrRev(fil, "\")) 'Acquire Path strfile = Mid(fil, InStrRev(fil, "\") + 1) 'Acquire filename strExt = Mid(strfile, InStrRev(strfile, ".") + 1, 3) 'Acquire extension Dim strZip As String strZip = strPath & Replace(strfile, "mdb", "zip") Dim zipFil As Object Set zipFil = objFSO.CreateTextFile(strZip) zipFil.WriteLine Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, 0) zipFil.Close Dim oApp As Object Set oApp = CreateObject("Shell.Application") 'oApp.NameSpace(strZip).CopyHere strPath & strfile oApp.NameSpace(CStr(strZip)).CopyHere strPath & strfile DoEvents Set oApp = Nothing Set zipFil = Nothing 'uncomment next line to delete file after zipped 'If objFSO.FileExists(strZip) Then objFSO.DeleteFile (fil) '- only delete source file is zip file is present End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.