Excel to WinZip in VBA

Jack in the UK

Well-known Member
Joined
Feb 16, 2002
Messages
3,215
Hi Guys

Nice on here have all my code want to add after save the ziple is zipped as save as file name already defined.

Guess VBA - any ideas guys

Rdgs


PS i have seen on old board some codes but i never really have sucess with them, dont know why
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
To add a file to an already created zip;

Sub ZipFile()
Dim ZipPath As String
Dim ZipIt As String
Dim Source As String
Dim Dest As String

ZipPath = "C:Program filesWinzip"
Source = "C:Final.xls" '"C:myfile.xls"
Dest = "C:tt.zip" '"C:MydestinationDir"
'Note spaces important
ZipIt = Shell(ZipPath & "Winzip32 -a " & Dest & " " & Source, vbNormalFocus)

End Sub

Some zip commands you may need to know;
Adding files:

The command format is:

winzip[32].exe [-min] action [options] filename[.zip] files

where:

-min specifies that WinZip should run minimized. If -min is specified,

it must be the first command line parameter.

action

-a For add, -f for freshen, -u for update, and -m for move. These

actions correspond To the actions described In the section titled

"Adding files To an Archive" in the online manual.

options

-r and -p correspond To the "Recurse Directories" and "Save Extra

Directory Info" checkboxes in the Add and Drop dialog boxes. -ex, -en,

-ef, -es, and -e0 options determine the compression method: eXtra,

Normal, Fast, Super fast, and no compression. The default is "Normal".

-s allows specification of a password. The password can be enclosed

In quotes, For example, -s"Secret Password". Note that passwords are

case-sensitive.

-hs option allows hidden and system files To be included.

filename.zip

Specifies the name of the ZIP involved. Be sure To use the full



HTH

Ivan
 
Upvote 0
Hi Ivan

Nice to see you post, and a big thanks, ill email to report.

A tip 'o the hat to my friend on the other side of the world, my thanks!
Your day is starting so please make it a good one, as my day starts to finish.

Well have a drink soon on the Email's, thank you :):):):):)

Rdgs
 
Upvote 0

Forum statistics

Threads
1,213,528
Messages
6,114,154
Members
448,553
Latest member
slaytonpa

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top