How to Zip an Excel File (3 Easy Ways)

Excel files can often be very large. In that case, storing and sharing them becomes a problem for Excel users. They can quickly and easily share them by compressing the file. In this article, we will discuss how to zip an Excel file in three easy ways.


Download the Practice Workbook


3 Suitable Ways to Zip an Excel File

In this article, we will discuss three handy ways to zip an Excel file. Firstly, we will use the Send command in Windows, followed by renaming the Excel file with .zip extension. Finally, we will use a simple VBA code to complete the task.


1. Using Windows Send Command to Zip an Excel File

In this method, we will use the Send command in Windows to zip the Excel file. Follow the outlined steps below to do the task.

Step 1:

  • Firstly, store your Excel file at a suitable location on your computer.

3 Suitable Ways to Zip an Excel File

Step 2:

  • Secondly, select the Excel file and right-click on the mouse.
  • Then, from the drop down option, select the Send to command
  • Finally, from the outstretched options select the compressed (zipped) folder option.

3 Suitable Ways to Zip an Excel File

Step 3:

  • Consequently, you will find that your Excel file has a copy with the extension .zip.

3 Suitable Ways to Zip an Excel File

Read More: How to Reduce Excel File Size Without Opening (with Easy Steps)


2. Renaming File to Zip an Excel File

In this instance, we will simply rename the Excel file by changing its extension to .zip. Follow the ensuing steps to do that.

Step 1:

  • Firstly, select the Excel file.
  • Then, go to the Home tab in the File Explorer ribbon.
  • From there, hoover down to the Rename tab and click on it.

3 Suitable Ways to Zip an Excel File

Step 2:

  • Secondly, write “.zip” in place of the Excel extension.
  • Then, hit Enter.
  • Consequently, a message box will appear.

3 Suitable Ways to Zip an Excel File

Step 3:

  • Finally, choose “Yes” from the box.

3 Suitable Ways to Zip an Excel File

Step 4: 

  • As a result, your Excel file will be zipped.

3 Suitable Ways to Zip an Excel File

Read More: How to Compress Excel File More than 100MB (7 Useful Ways)


Similar Readings


3. Applying VBA Code to Zip an Excel File

Here, we will use a simple VBA code to zip the file. Adhere to the subsequent steps below to accomplish the task.

Step 1:

  • Firstly, go to the Developer tab in the ribbon.
  • Then, click on the Visual Basic command.

3 Suitable Ways to Zip an Excel File

Step 2:

  • Thirdly, in the Visual Basic tab, click on Insert.
  • Then, select the Module tab.
  • Consequently, a coding module will appear.

Sample Data

Step 3:

  • In the coding module, write down the following code.
  • Then, save the code.
Sub exceltoZipFile(ZipFolder As Variant, FileName As Variant)
'declaring an object
Dim shell_app As Object
'creating an empty zip file
Open FileName For Output As #1
Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)
Close #1
'copying the excel file to the zip file
Set shell_app = CreateObject("Shell.Application")
shell_app.Namespace(FileName).CopyHere shell_app.Namespace(ZipFolder).items
End Sub

Sub zipped()
Call exceltoZipFile("D:\The Office\zip an excel file\", "D:\The Office\zippedfile.zip")
End Sub

Sample Data

VBA Code Breakdown

  • Sub exceltoZipFile(ZipFolder As Variant, FileName As Variant): Her, we have named the function exceltoZipFile which has two arguments namely:  ZipFolder and FileName , both are Variant type.
  • Dim shell_app As Object: Here, we have declared a variable named shell_app which is an Object.
  • Open FileName For Output As #1 Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0) Close #1: Here, we have created an empty zip file. The character in the middle line is an indication for Windows to create an empty file.
  • Set shell_app = CreateObject(“Shell.Application”)shell_app.Namespace(FileName).CopyHereshell_app.Namespace(ZipFolder).items : Here, we have copied the files to the empty zip file that we have previously created.
  • Call exceltoZipFile(“D:\The Office\zip an excel file\”, “D:\The Office\zippedfile.zip”): Here, we have called the exceltoZipfile function for execution.

Step 4:

  • Finally, go to the Run tab and click on it.
  • From the drop-down option, select the Run command to run the code.

Sample Data

Step 5:

  • As a result, you will find that your Excel file is zipped.

Sample Data

Read More: Reduce Large Excel File Size by 40-60% (12 Proven Methods)


Conclusion

Large Excel files take up a lot of space, and they are very difficult to share. Reducing their size effectively solves these problems. After going through this article, the readers will have a thorough understanding of zipping an Excel file. This will allow them to handle large Excel files efficiently. Please feel free to leave a comment if you have any queries or recommendations for improving the article’s quality. To learn more about Excel, you can visit our website, ExcelDemy. Happy Learning!


Related Articles

Adnan Masruf

Adnan Masruf

I am an engineering graduate. I graduated from Bangladesh University of Engineering and Technology(BUET), one of the top universities in Bangladesh from department of Naval Architecture & Marine Engineering with a major in structure. I am an avid reader of fiction especially fantasy. I also keep myself abreast of the recent developments in science and technology. I believe diligence will eventually pay off and luck tends to favor those who work hard.

We will be happy to hear your thoughts

Leave a reply

ExcelDemy
Logo