In order to put together a small book for the kids' elementary school, I had to find a way to automate Microsoft Word to build web pages. I know people in the publishing industry do this frequently with QuarkXPress and AppleScript, and when I saw that Word for OS X had AppleScript support, I figured it would be a snap.
However, I'm not a great scripter, and when I when searching on the web for examples showing how to script Word, I couldn't find much at all. What I did discover is that Word has a reputation for problems with AppleScript. Whether or not that's true, there certainly is a dearth of good examples for using AppleScript with Word. Of course, Word comes with its own scripting language, VBA. This is incredibly popular in the Windows world for scripting Word (and Excel, and other Office apps), but the Mac version of Word also supports it. But since I've never worked in VBA at all, I was nervous about trying to do my project exclusively using VBA.
Then I discovered you can actually use both technologies together -- and AppleScript can send VBA commands to Word, one at a time. And there is tons of VBA information to be had on the web. Anyway, here's a sample AppleScript that shows how to use AppleScript and VBA together to put together a Word web page. I'm no AppleScript expert, and I've never used VBA before, but if you're a beginner, too, maybe you can find something useful here!
[robg adds: Due to the width of some of the lines, I chose to upload the script. The above link should open it in a new window, ready for a quick copy and paste.]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040624203817866