Zip a file or folder using no 3rd Partys apps/DLL'S
Posted: 2002-06-01
By: ArchiveBot
Viewed: 121
Filed Under:
No attachments for this post
This code will zip any file or folder
Original Author: Mason Reece Soiza
Code
Private Sub Command1_Click()
CreateEmptyZip "c: estzip.zip"
With CreateObject("Shell.Application")
.NameSpace("c: estzip.zip").CopyHere "c:FirePassword.exe"
' .NameSpace("c: estzip.zip").CopyHere .NameSpace(FolderName).items 'use this line if we want to zip all items in a folder into our zip file
End With
' All done!
End Sub
Public Sub CreateEmptyZip(sPath)
Dim strZIPHeader As String
strZIPHeader = Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0) ' header required to convince Windows shell that this is really a zip file
With CreateObject("Scripting.FileSystemObject")
.CreateTextFile(sPath).Write strZIPHeader
End With
End Sub
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.