How can I GZip compress a file from Excel VBA using code in an .xla file only?

前端 未结 5 1285
情深已故
情深已故 2021-01-06 08:32

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 withou

5条回答
  •  臣服心动
    2021-01-06 09:24

    OK, I think I have an answer for you.

    zlib is a library written by the guy that wrote the deflate algorithm you don't want to implement. There is a win32 DLL available. Here's the FAQ regarding using it from Windows:

    http://www.zlib.net/DLL_FAQ.txt

    Check out question 7. The authors don't seem too keen on Windows users, and don't seem at all keen on VB users, but as long as they're kind enough to provide the library we can do the rest.

    If this is enough to help you, then great. If you want help with calling the C library from VBA add a comment and we'll figure it out. I haven't done any VB-to-C calls in years--it sounds like fun.

提交回复
热议问题