Link to home
Start Free TrialLog in
Avatar of David MacDonald
David MacDonaldFlag for Canada

asked on

Launching WinZip from the Shell

Hi experts,
           i've been trying to start winzip from the shell, but each time, I have the file not found error  ... !!??

But if I paste the content of strCommande in the "run" box of Windows, it goes ok.  What am I doing wrong here ?

Here is my code:

*********************
these are the parameter sent to the function :

GestionWinZip.GestionWinZip m_strEnvironnement, "c:\test.zip", Fichier.Path

m_strEnvironnement = "CAPDEV"
Fichier.Path = "D:\Donnees_devl\CAP2002\Capfax\ReceptionRsp\Capdev\1004363.rsp"

Public Sub GestionWinZip(ByVal strEnvironnement As String, ByVal strNomArchive As String, ByVal strFichiers As String)
   
    Dim strWinZipPath As String
    Dim strCommande As String
   
    Dim fso As New Scripting.FileSystemObject
   
    On Error GoTo TrappeErreur
   
    'Si le nom du fichier à compresser possède des espaces, l'entouré de ""
    If InStr(1, strFichiers, " ", vbTextCompare) <> 0 Then
        strFichiers = Chr(34) & strFichiers & Chr(34)
    End If
           
    If (Not fso.FileExists(strNomArchive)) Then
        fso.CreateTextFile (strNomArchive)
    End If
   
    strCommande = "WINZIP32.EXE -min -a " & strNomArchive & " " & "'" + strFichiers + "'"
   
    Shell(strCommande, vbHide)
   
    'Shell("winzip32 -min -a c:\test.zip c:\op.txt", vbHide)
   
    Set fso = Nothing
   
TrappeErreur:
   
    Set fso = Nothing
   
    Err.Raise vbObjectError + 100, "Projet1.GestionWinzip", "Problème avec la compression WinZip."

End Sub

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

The same thing happens when I do a test with :

 Shell("winzip32 -min -a c:\test.zip c:\op.txt", vbHide)

THanks a lot, and a lot of beer to ya all !

Regards!
ASKER CERTIFIED SOLUTION
Avatar of Informative
Informative
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of David MacDonald

ASKER

hahah ... funny me ... the idea of the coming beer must've clouded my mind with hapinness ... itwork well with the full qualified path ...

Thanks a lot Informative ...