Thursday, February 14, 2008
MS Word automation and Constants database
I really did not want to miss John Head's Jumpstart session on desktop integration with MS office. It's been one of those sessions that's evaded me the past couple of years and I vowed not this year. I mean, I've done some Word and Excel automation. Nothing too complex. This year, I was right in the middle of a Word automation project and it was a perfect time for this session. You know that feeling you get when you hear a small gem that makes your life so much easier. Funny thing is that I knew this technique at some point but it was in a part of my memory that must be where the dead brain cells hang out. John discussed a bunch of cool integration stuff but the simple idea of turning on the macro recorder and grabbing the VB code was exactly what I needed for this project. Also, Tom Duff has a Notes database out on OpenNtf that contains the MS Contstants and their number equivelant. Get it here. (It took me a while to find) You see, MS Word gives you contants like WDToggle and Notes has no idea what that means. You simply replace the constant with the number from Tom's database. Using this method, one of the things I was able to do was create dynamic tables with the proper format. The great thing about this Office automation stuff is that it amazes your users and it's not that hard to do. Especially, with these two shortcuts, you can be the wizard.