Month: May 2015

Using the free zip library in VBA

In a previous post I briefly explained how you can compile the free zlib library with Visual 2013 Studio and produce a 32 and a 64 bits dll that you can then use in VBA (Word, Excel, Access, etc…). If you follow this link to the article, you can even download the binaries I baked.

However, to use these dlls in a real world project, we need to wrap them in some 32/64 bits VBA code.
Inspired by samples I found on the web, here a quickly reusable module for your VBA projects.
Look at the TestXXXX procedures (change the pathes and filenames, of course, and execute them in the immediate window) for some samples.

Enjoy!

How to get the same result in VBA and in PHP computing a CCITT CRC checksum

I was working last week on a Microsoft Access application and I needed to get some data from a webserver running Apache/PHP. Exchanging data with the server was easy, the WinHTTP and XML ActiveX library components are really cool and easy to use for that. But then I came unto some unexpected trouble when I tried to use a CRC check on both the VBA and PHP side to quickly add some integrity checking on the exchanged data.

I already had a VBA routine computing a CRC checksum, but had none on the PHP side. So I thought “google it up”, pick the first CRC checksum routine that comes up and use it, easy. By the way, if you want to refresh your neurons about the CRC stuff, you can read more about that in wikipedia.

To make a long story short, there are many algorithms out there, for VBA and PHP, and to find two that go well along and yield the same result, it takes some time and tries.

So, here are the two ones I now use. Enjoy !

VBA Cyclic redundancy check CRC16_2 function

And in PHP: