I have put a very brief guide to it there too.
I got caught up in a bit of a quandary due to various incompatibilities.
Basically the Microsoft xll SDK for Excel 97 is simpler and easier to understand, but only works with VC6.0 or earlier (using the simple approach I use). This is generally the one I use, because there is less risk of additional run-time dependencies.
One of the SDK functions takes a string and modifies it by adding the byte count to it. You can even pass this function a fixed string as in “Hello”, and it will modify it. VC6 allowed that, VC2003 onwards don’t. There are (at least) two possible fixes
- put the hello in a variable and then pass the variable
- change the function to create a new string and return that (I chose this as I think it keeps the actual xll code simple)
The Microsoft xll SDK for 2007 is more complex because it covers the new features introduced in that version, and is based on VC2005 or newer.
Actually setting up Visual Studio C++ to work with the SDK is a bit of a step if you are new to it, so in the end here is what I have done:
I have changed the function in the 97 SDK that broke more recent compilers, and I have included that SDK with the base project. I have included a VC6,0 project file and a VC2008 one so it can be opened and worked with with VC2008 Express immediately, with no set up required.
I wouldn’t normally modify or redistribute someone else code but in this case I think it makes it so much easier for people to get going with this technology I think it makes sense. I did have a quick ratch around to make sure that wasn’t a breach of the SDK licensing but nothing jumped out at me. If its a problem I’ll take it down.
Of course its just barely tested, so if you have any problems then let me know