gibsonca has asked for the
wisdom of the Perl Monks concerning the following question:

Hi all,

Where do I find the complete information on what I can do with Win32::OLE, when modifying an M$ word document? For example, I found that following code on the web, and it works on my MS Word input file, but I would like to know 'the rest of the story'.

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

I'm writing something to hack Excel (I can't help specifically with Word), and one of the techniques I have found useful is to write a VBA prototype. That way, you can work out the VBA references using intellisense, which typically gives you all the available options. Then it's relatively simple to rewrite the Messware code in Perl. The one thing I can't help you on is why and when {braces} are needed. The only Excel use I have found is in $app->{Visible} = 1. Watch out, though, for case. Perl is case sensitive while VBA isn't - it will convert case for you, and whatever it gives you is what you should use.

Win32::OLE is an API to access OLE/COM Servers. Word is an OLE Server and it has an Object Model defined in it's documents or in the macro suite as mentioned in Re: Where is the Win32::OLE Docs. The properties/methods and the types of arguments to pass to them are defined in the Object Model. Grab a copy of Win32 Perl Programming: The Standard Extensions (2nd Edition) for a gentle introduction to OLE Automation. It's old but still valid. It will not help you to write MSWord controllers but will help you to understand how it works and summarizes the core concepts.