We help IT Professionals succeed at work.

Call Winzip using VB

ywingyan
ywingyan asked
on
I am writing a program to Zip a file. How can i call winzip by using VB? What is the Command line to call it??? and it need to rename the file's name after it zip
thanks a lot!!
Comment
Watch Question

Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:
Hi,

Find out the solution at: http://www.winzip.com/faq.htm

regards
Ryan ChongSoftware Tead Lead / Business Analyst / System Analyst / Data Engineer
CERTIFIED EXPERT

Commented:

Commented:
here try here i found some info on this sort of thing before to be usfull.

http://www.pscode.com/xq/ASP/txtCodeId.14063/lngWId.1/qx/vb/scripts/ShowCode.htm


and also all about compressing files with winzip.

http://www.pscode.com/xq/ASP/txtCodeId.4696/lngWId.1/qx/vb/scripts/ShowCode.htm

hope it helps
Hi,
Can you try this
http://vbaccelerator.com/codelib/zip/unzip.htm
Regards
Sridhar
Valliappan ANSenior Tech Consultant
CERTIFIED EXPERT

Commented:
If you are not particular about WinZip, and you just want to compress files, you could have a look at:

http://www.experts-exchange.com/jsp/qShow.jsp?ta=visualbasic&qid=20171329

Ok, in short (as in the above link), you can use pkzip.exe to zip it:

******

Dim lZipPath As String
dim lZipSpec As String

lZipPath="a:\zipfile"
lZipSpec="*.fr* *.vb* *.bas"
Shell "C:\Command.com /C pkzip.exe -& " & lZipPath & " " & lZipSpec
Msgbox "Copy Completed."

******

Cheers.

Wish A Happy New Year,
Valliappan AN.

Author

Commented:
Function winZipit(ByVal source As String, ByVal target As String, ByVal zip As Boolean)
zipIT = "C:\program files\winzip\WINzip32 -a"
'    unzipIT = App.Path & "winzip32 -e "


'    If zip = True Then
    Shell (zipIT & target & source)
'    Else: Shell (unzipIT & target & source)
'    End If
End Function

Author

Commented:
Wrong msg....

Thanks all  ^-^

i was try my program like this

****************

'SelectedFile is the path and the file name that i want to zip

Function winZipfile
    zipIT = "C:\program files\winzip\WINzip32 -a"
    target = App.Path & "\test.zip"
    Shell (zipIT & target & SelectedFile)
End Function

***************

but it got "WinZip parameter validation error"

/____\

yan
Commented:
try this

Function winZipfile
   zipIT = "C:\program files\winzip\WINzip32 -a " '*** Added one space at the end after -a
   target = App.Path & "\test.zip "'*** Added one space at the end after .zip
   Shell (zipIT & target & SelectedFile)
End Function


Author

Commented:
Thanks a lot I can Zip a file!!

^-^