MACROFUN.H

I’ve added the header macrofun.h to make it a bit more convenient to call functions in MACROFUN.HLP. If there were truth in naming it would be called macronofun.h.

Creating spreadsheets by hand is labor intensive and they tend to acquire cruft as time goes by. When a client gave me a spreadsheet I created a year ago, it somehow had over 4,000 styles. See http://support.microsoft.com/kb/213904 for helpful advice if you ever run across this.

My first thought was to create golden copies using XML but I quickly realized I would need some sort of macro language to help generate common modules. I came across XBL and quickly decided poking flaming stakes through my eyes would be preferable to using this.

There are a bunch of Office tools available but I decided to just use straight C++ and calls to Excel. C++ makes a perfectly fine macro language, thank you very much. See xls.cpp in the test folder for examples of how to do this.

There are now variadic macros XLL_XLC, XLL_XLF, and XLL_XL_ that make it slightly easier to call macro functions. E.g., XLL_XLC(Selection) expands to Excel<XLOPERX>(xlcSelection). I’ve also added some enumerations and inline functions for common tasks. The call FormatFont(_T("Courier"), 12, FS_BOLD|FS_ITALIC, OLIVE_GREEN) would format the current selection in 12 point Courier bold italic in an ugly color.

It is good practice to use styles when creating spreadsheets. If you mark cells as Input, Output, Calculation, etc, then you can easily change the presentation of the sheet.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s