using winzip command line processor

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • hannahg

    #1

    using winzip command line processor

    I am trying to incorparate the win zip command line processor in my
    code on an Access 2003 database form. The code that I downloaded made
    a call to the windows api. It requires that you use short names
    because it works in the command window. The call is to
    apiGetShortPath Name from the kernel. It works great for returning the
    short name for the xls file I am zipping. But then when I use the same
    path and name with a zip extension is comes back empty. Is there some
    security issue with zip files that it is running into? This call is
    from a function called fGetShortName that I downloaded from the
    mvps.org website.

  • King Ron

    #2
    Re: using winzip command line processor


    hannahg wrote:
    I am trying to incorparate the win zip command line processor in my
    code on an Access 2003 database form. The code that I downloaded made
    a call to the windows api. It requires that you use short names
    because it works in the command window. The call is to
    apiGetShortPath Name from the kernel. It works great for returning the
    short name for the xls file I am zipping. But then when I use the same
    path and name with a zip extension is comes back empty. Is there some
    security issue with zip files that it is running into? This call is
    from a function called fGetShortName that I downloaded from the
    mvps.org website.
    You don't have to use the short name - you can pass in a regular
    Windows Path if you surround it in quotes. The following function will
    automatically compress a password protected zip file and FTP it using
    the InetCtls ocx. This is compiled code so I'm not gonna change it for
    readability, but most of the variable names and functionality should be
    decipherable. The lines you are interested in are these:

    wkCmnd = "C:/Program Files/WinZip/wzzip.exe -yp -s" & Me.ufISACFtpPwd
    & " """ & wkZipt & """ """ & wkText & """"
    OK = Shell(wkCmnd, vbMaximizedFocu s)


    wkCmnd is a string, OK is a boolean. wkZipT is the path of the Zip file
    being created and wkText is the path to the text file source. See the
    Winzip command line processor help for any questions on the the wzzip
    command line parameters I've got here.

    Remember that to insert a double quote inside a string literal you have
    to put 2 double quotes together so & " """ will concatenate one space
    and double-quote to the text string being fabricated.


    <compiled code>

    Private Sub btnISACFileSend _Click()
    Dim TX As New InetCtlsObjects .Inet
    Dim wkPath As String
    Dim wkText As String
    Dim wkZipt As String
    Dim wkDest As String
    Dim wkCmnd As String
    Dim OK As Boolean
    Dim SQ As String

    On Error GoTo ISACFileSendErr
    SQ = "Sending MAP Payment Request File to ISAC FTP server!!!" &
    vbCrLf & _
    "Do you wish to continue?"

    If (MsgBox(SQ, vbYesNo, "Post MAP to ISAC") <vbYes) Then GoTo
    ISACFileSendExi t

    wkPath = DLookup("[usTempPath]", "uSysCtl", "[usID] = 1")
    ChDir wkPath

    wkText = wkPath & "\" & Me.ufISACFtpSou rce
    wkZipt = wkPath & "\" & Me.ufISACFtpDes t
    wkDest = Me.ufISACFtpDes t

    wkCmnd = "C:/Program Files/WinZip/wzzip.exe -yp -s" & Me.ufISACFtpPwd
    & " """ & wkZipt & """ """ & wkText & """"
    OK = Shell(wkCmnd, vbMaximizedFocu s)

    With TX
    .Protocol = icFTP
    .URL = Me.ufISACFtpIP
    .UserName = Me.ufISACFtpUse r
    .Password = Me.ufISACFtpPwd

    wkCmnd = "SEND " & wkZipt & " " & wkDest
    .Execute , wkCmnd
    End With

    OK = MsgBox("MAP Payment Request File Successfully Posted", vbOKOnly,
    "MAP File Send Success!!!")

    ISACFileSendExi t:
    Set TX = Nothing
    Exit Sub

    ISACFileSendErr :
    If (Err = 53) Then
    Resume Next
    Else
    MsgBox "Error in ISACFileSend: " & Err & ": " & Err.Description
    Resume ISACFileSendExi t
    End If
    End Sub


    </compiled code>

    King Ron of Chi

    Comment

    Working...