Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Accessing File from Winzip (Access 2000)

    I receive a bunch of upload files as a zip file. I've already written code to upload the txt files. Is it possible to automate the task further by using MSshell inside VB in order to extract the files and then run the code on the extracted txt files?

    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Accessing File from Winzip (Access 2000)

    If you have WinZip 9.0, you can download the free WinZip Command Line Support Add-On. This will allow you to use command line instructions to zip/unzip archives, and this in turn can be done in VBA code by issuing Shell instructions.

  3. #3
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Accessing File from Winzip (Access 2000)

    Hans could you please help with some code around the MSshell. I'm clueless with MSshell

    Thanks for the help

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Accessing File from Winzip (Access 2000)

    I don't have the Winzip Command Line thingy myself, so I don't know the instructions needed. Perhaps someone else can help.

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Accessing File from Winzip (Access 2000)

    Example of using WinZip Command-Line add-in in VBA:

    Private Declare Function ShellExecute Lib "shell32.dll" _
    Alias "ShellExecuteA" _
    (ByVal hwnd As Long, _
    ByVal lpOperation As String, _
    ByVal lpFile As String, _
    ByVal lpParameters As String, _
    ByVal lpDirectory As String, _
    ByVal nShowCmd As Long) As Long

    Private Const SW_SHOWNORMAL = 1
    Private Const SW_SHOWMINIMIZED = 2
    Private Const SW_SHOWMAXIMIZED = 3
    Private Const SW_SHOW = 5
    Private Const SW_MINIMIZE = 6
    Private Const SW_SHOWMINNOACTIVE = 7
    Private Const SW_SHOWNA = 8
    Private Const SW_RESTORE = 9
    Private Const SW_SHOWDEFAULT = 10

    Public Sub TestUnzip(ByRef strZipFile As String)

    ' Use WinZip Command Line Support Add-On to unzip files:
    Dim strAppPath As String
    Dim strArgs As String
    Dim strUnzipPath As String

    strAppPath = "C:Program FilesWinZipWZUNZIP.EXE"
    ' Unzip files in same folder as Zip file:
    strUnzipPath = Left$(strZipFile, InStrRev(strZipFile, "", , vbBinaryCompare) - 1)

    ' Overwrite existing files (-o):
    strArgs = "-o " & Chr$(34) & strZipFile & Chr$(34) & Chr$(32) & _
    Chr$(34) & strUnzipPath & Chr$(34) & _
    " *.mdb"
    ' C:AccessTempTemp.zip

    ShellExecute Application.hWndAccessApp, _
    "open", _
    strAppPath, _
    strArgs, _
    vbNullString, _
    SW_SHOWMINNOACTIVE


    End Sub

    This example unzips files that meet *.MDB specification to same folder as Zip file, overwriting existing files if any (-o option) (otherwise you will have to respond to command line prompt). There are dozens of options available, see WZUNZIP reference, WinZip Command Line Support Add-On Help file. Obviously you, and anyone using your application, will need the add-on (& WinZip itself) to be able to use this. See WinZip web site for more info:

    WinZip Command Line Support Add-On 1.1

    HTH

  6. #6
    3 Star Lounger
    Join Date
    Aug 2001
    Location
    Cape Town, South Africa, South Africa
    Posts
    399
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Accessing File from Winzip (Access 2000)

    Thanks Hans & Mark

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Accessing File from Winzip (Access 2000)

    Mark

    Great code

    I was going to be asking for this in a few days.

    John

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •