convert all .xls files to winzip

getuday

New Member
Joined
Nov 30, 2010
Messages
23
Hello All,

Can we with a help of Macro or VBA convert all the .xls file in one folder to winzip or 7z files. There are say 900 files in one folder.

Thanks in advance,

Uday Naik:confused:
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Place workbook with macro into folder with files.
Code:
[COLOR="Blue"]Sub[/COLOR] ToZIP()

    [COLOR="Blue"]Dim[/COLOR] fso [COLOR="Blue"]As[/COLOR] [COLOR="Blue"]Object[/COLOR], aFile [COLOR="Blue"]As[/COLOR] objec
    
    [COLOR="Blue"]Set[/COLOR] fso = CreateObject("Scripting.FileSystemObject")
    
    [COLOR="Blue"]For[/COLOR] [COLOR="Blue"]Each[/COLOR] aFile [COLOR="Blue"]In[/COLOR] fso.GetFolder(ThisWorkbook.Path).Files
        [COLOR="Blue"]If[/COLOR] fso.GetExtensionName(aFile.Name) [COLOR="Blue"]Like[/COLOR] "[Xx][Ll][Ss][XxMm]*" [COLOR="Blue"]Then[/COLOR]
            [COLOR="Blue"]Name[/COLOR] aFile.Name [COLOR="Blue"]As[/COLOR] Replace(aFile.Name, "." & fso.GetExtensionName(aFile.Name), "") & ".zip"
        [COLOR="Blue"]End[/COLOR] [COLOR="Blue"]If[/COLOR]
    [COLOR="Blue"]Next[/COLOR]

[COLOR="Blue"]End[/COLOR] [COLOR="Blue"]Sub[/COLOR]
 
Upvote 0
<TABLE cellSpacing=0 cellPadding=2 width="100%" border=0><TBODY><TR><TD align=left>Hello all,

Thanks for replying......

I want the name to be same as the excel file. Say for example the name of the excel file is abc01003.xls it should change to abc01003.zip or abc01003.7z

and there are 800 to 900 files in it, all with different names. so the names should be same only the extension should change from .xls to .zip or .7z

Thanks & Regards,

Uday Naik</TD></TR></TBODY></TABLE>
 
Upvote 0
Hello All,

Do you have reply for this post..if yes then please reply...

Thanks & regards,
Uday Naik
 
Upvote 0
Excellent - quick and easy to install and use. Highly recommended!
426630_com_5starsa.jpg
 
Upvote 0
Hi Andrew Poulsom,

Thanks a lot for the link...It worked for me...Thanks a lot

God bless you

Thanks & regrds,

Uday Naik
 
Upvote 0

Forum statistics

Threads
1,224,517
Messages
6,179,237
Members
452,898
Latest member
Capolavoro009

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