David MacDonald
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.GestionWinZi p m_strEnvironnement, "c:\test.zip", Fichier.Path
m_strEnvironnement = "CAPDEV"
Fichier.Path = "D:\Donnees_devl\CAP2002\C apfax\Rece ptionRsp\C apdev\1004 363.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(strNomArchi ve)) 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!
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.GestionWinZi
m_strEnvironnement = "CAPDEV"
Fichier.Path = "D:\Donnees_devl\CAP2002\C
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(strNomArchi
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a lot Informative ...