Solved

Launching WinZip from the Shell

Posted on 2003-11-25
2
427 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DO Loop not working 4 64
Access 2016 VB code 9 86
A macro to Count the number of rows across all worksheets 3 63
Copy a row 12 53
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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 utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

747 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

13 Experts available now in Live!

Get 1:1 Help Now