Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2003, 11:19 AM
Registered User
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Zip File

How can I zip an Access file through VBA?
 
Old December 29th, 2003, 11:45 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

I am not sure if you can do that directly with VBA. There may be some third party COM components that can do zipping.

What you could do is use the WinZip command line add on. This add on supports zipping and unzipping from the command line. Together with a WScript.Shell object, you can zip from within VBA code. Here's a small example:
Code:
Dim objShell
Set objShell = CreateObject("wscript.shell")
' Zip file with command-line WInZip
Dim ReturnValue
ReturnValue = objShell.Run("C:\winnt\system32\cmd.exe /C c:\wzzip.exe -a MyFileName.zip MyFileToZip.doc", 1, True)
If you have a registered version of WinZip, you can download the add on here: http://www.winzip.com/wzcline.htm

Cheers,

Imar



---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
zip file Venkatesan .NET Framework 1.x 1 July 4th, 2007 02:25 AM
how can i zip file?? rocksbhavesh VB How-To 1 April 6th, 2007 12:55 PM
Zip File Venkatesan General .NET 0 February 3rd, 2007 05:59 AM
Create zip file sepidehsalek Biztalk 0 February 12th, 2005 06:27 AM
Error in zip file dat2199 BOOK: Professional C#, 2nd and 3rd Editions 0 December 4th, 2003 04:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.