Monthly Archives: August 2013


13Homer pointed out my Visual Studio 2012 libraries were actually built using VS 2010. All I can say is “Doh!” That’s fixed now, just install the latest As an added bonus, you should see the Xll AddIn Project template show up in Visual Studio 2012 now. I figured out how to wrestle WiX into installing files outside of TARGETDIR. Where by I figured it out I means some clever guy gave me the right hints. I would rather poke flaming stakes though my eyes than use InstallShield Limited Edition, Limited being the operative word.

I spent some quality time today learning some new tricks. James Abbot McNeill Whistler has a great quote. (When Oscar Wilde heard a witty remark and said “I wish I had said that,” Whistler replied “You will, Oscar, you will.” Whistler has a lot of great quotes.)

Industry in art is a necessity—not a virtue—and any evidence of the same, in the production, is a blemish, not a quality; a proof, not of achievement, but of absolutely insufficient work, for work alone will efface the footsteps of work.

He’s right about that. I’m always struggling with the complexity of software. The volume keeps increasing and it is difficult to keep up. Sales guys know all about profiling. Dump a customer as quickly as possible that is never going to buy. Same story with programming languages du jour that are a waste of time to learn.

Let’s get down to the dirty bits. This post is about $(PlatformToolset). If you install the latest version of the xll library and your project can’t find xll.lib right click on the project, Properties > Linker > General. Change Additional Library Directories to


New projects should work fine. If I were Whistler, I would man up and figure out how to put in links from the old 10 and 11 folders to v100 and v110. It is probably easy to do if you know the proper WiX incantations. Happy to put that in if anyone knows how.

This is what I worked on today:

WiX really, really wants you to install every file under the TARGETDIR. For good reasons. But this shows is a way around that. Define any directory you want under TARGETDIR then SetDirectory to any value you want.


I used to be crazy about chess. I spent a lot of time studying it but only managed to get to the USCF Expert level (2000-2200). Roughly equivalent to a Category A player in the Russian ranking system.

The highest rated player in the history of chess is a 23 year old Norwegian kid, Magnus Carlsen. He is going to play Vishy Anand in November for the world championship.

I confess that I do not understand chess these days. Carlsen gives up a pawn to a grandmaster for no apparent compensation, wins it back 10 moves later to get a drawn endgame, which he then proceeds to win.

In tournament chess it is touch, move. If you touch a piece, you have to move it. If you just want to adjust a piece that is off kilter, you can say “J’adoube” and adjust the piece without being required to move it.

One add-in everyone seems to love is It only does one thing: adds a right click cell menu item that calls XLL.ADJUST. If an Excel function returns an array, it is always a bit of a mystery figuring out the size of the array being returned. Keep selecting more cells, hit Control-Shift-Enter, then Control-Z when you start seeing #NA’s. XLL.ADJUST figures out the correct size and just blams it into your spreadsheet.

Plop it in XLSTART if you can, or use the Add-In Manager if you prefer that.

There is a better way of doing this. Use RANGE.SET and RANGE.GET to deal with Excel’s limitation of wearing it’s data on it’s sleeve. See for how to use ancient APL notions to solve your current problems. It uses the modern concept of monads, but they have been around for a long time before people learned they were writing prose all their life.

Handling handles

My friend Deane Yang pointed out returning invalid handles as 0 is not the Excel thing to do. Those get propagated down the line to dependent functions which then keep reporting errors. The right way to do it is to return std::numeric_limits::quiet_NaN() instead. That shows up as #NUM! in Excel and dependent calculations never get called.

I’ve added a class called xll::handlex that is a replacement for HANDLEX and sets the default handle value to a NaN.