Solved

Launching WinZip from the Shell

Posted on 2003-11-25
2
429 Views
Last Modified: 2008-03-06
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!
0
Comment
Question by:David MacDonald
2 Comments
 
LVL 3

Accepted Solution

by:
Informative earned 75 total points
ID: 9820347
This works fine for me.

Dim x As Variant
x = Shell("winzip32.exe -min -a c:\test.zip c:\op.txt", vbHide)

All I had to do to make it work properly was either give the full qualified path of winzip or else copy everything from the winzip folder into say Windows\system32 where it will be certainly found in the path.  I'm using Winzip 8.1

Cheers and have a Slurpee on me.
0
 
LVL 1

Author Comment

by:David MacDonald
ID: 9820369
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 ...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now