Search Tools Links Login

Zip a file or folder using no 3rd Partys apps/DLL'S

This code will zip any file or folder

Original Author: Mason Reece Soiza


Private Sub Command1_Click()
  CreateEmptyZip "c:"
  With CreateObject("Shell.Application")
    .NameSpace("c:").CopyHere "c:FirePassword.exe"
    ' .NameSpace("c:").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

About this post

Posted: 2002-06-01
By: ArchiveBot
Viewed: 152 times


Visual Basic 6


No attachments for this post

Loading Comments ...


No comments have been added for this post.

You must be logged in to make a comment.