Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 58025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:47:00+00:00 2026-05-10T17:47:00+00:00

I need to be able to GZip compress a file in an Excel VBA

  • 0

I need to be able to GZip compress a file in an Excel VBA function. Specifically I need to be able to use the ‘deflate’ algorithm.

Is there a way to do this without having to exec a command line application? With no dependency on external tools the code will be more robust.

Ideally the code would make use of pre-installed VBA or COM library functions – I don’t want to have to implement this logic myself or install DLLs etc.

If possible, I want installation of the function to be as simple as adding a .xla to the available Excel Add-Ins. No DLLs, EXEs, registry entries etc. required.

Edit Can I make use of the .NET GZipStream to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T17:47:00+00:00Added an answer on May 10, 2026 at 5:47 pm

    VBA (which is really a dialect of VB6) is slow for these kind of applications. I remember I once implemented Shannon-Fano algorithm on VB6 and on C, the C version was about 10 times faster, even after being turned into a DLLMain and called from there rather than on a command-line executable.

    There are lots of COM DLLs that provide compression services, both open source and shareware, and some of them implement GZIP’s deflate algorithm. It’d be really simple to just call one function from such a DLL from your VBA code to do the compression on your behalf.

    I understand your being reluctant on using something external to your application, though in this case you might have to apply an exception for performance’s sake.

    In an effort to completely spoil your fun, examine file ZIPFLDR.DLL on windows\system32. you may also like to take a look at these links:

    • This has an example of how to do what you want (zipping using windows built-in ZIP capabilities) from VB.NET, it shouldn’t be much different from VBA or VB6: Transparent ZIP with DLL call
    • This one has a sample application on VB6 using windows built-in capabilities to zip (in ZIP rather than GZIP format, of course): Using Windows XP "Compressed Folder" shell extension to work with .zip files

    Found both thru googling, you should be able to find more/better examples.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to be able to load the entire contents of a text file
i have this multidimensional array in php and I need be able to access
I need to be able to create basic MS Project items (tasks, projects, resources,
I need to be able to get at the full URL of the page
I need to be able to get a list of the groups a user
I need to be able to merge two (very simple) JavaScript objects at runtime.
I need to be able to quickly convert an image (inside a rails controller)
I need to be able to periodically send email alerts to subscribed users. PHP
I need to be able to take a string like: '''foo, bar, one, two,
I need to be able to launch a process and read the output into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.