Create Zip folder from .txt files

lwarren30

New Member
Joined
Jul 3, 2018
Messages
35
Hi all,

I am trying to create a zip folder from three .txt files. I've written the code to create the .txt files and I now need to take those file and create a zip folder. I have not found anything online to create a zip without errors. Any suggestions?

Thank you in advance.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
You could use a powershell command from VBA to do this:

Shell("powershell.exe -command ""Compress-Archive {filepath-xlsx}, {filepath-xlsx} {filepath-zip}"" ")

An example:

Shell("powershell.exe -command ""Compress-Archive D:\_Share\20200430\1.xlsx, D:\_Share\20200430\2.xlsx D:\_Share\20200430\myzip.zip"" ")

Note if there's any space in the filenames or paths you will need to put ' around the filepaths, so e.g. 'D:\_Share\20200430\One Two Three.xlsx'
 
Upvote 0

Forum statistics

Threads
1,216,923
Messages
6,133,521
Members
449,809
Latest member
Bhad007

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