From: james@... Date: 2002-05-31T12:53:22+09:00 Subject: RE: editing .doc files > > Hi All, > I have a friend who recently moved her office. She now needs to change > the addresses in her many .doc forms and templates to the new address. > Is there a doc file batch processor in ruby. Or does anybody know of > such a thing. I know very little about M$ word. > You or she may be better off writing a VBA (Visual Basic for Applications) macro. Word documents are typically stored in a binary format, and it can vary depending on whether "fast save" was used or not. It's possible to grep a binary Word doc for strings, but to edit it would require either loading it into a Word-aware application (i.e., Word), or converting it to RTF and then manipulating it. Now, you can script Word using Ruby and Win32OLE or RubyCOM or something of that ilk, but ultimately you need more knowledge of the Word document model than you do of the particular scripting language. And if you use Word's VBA IDE you get neat-o command completion to help you find the right code. You can jump-start the code by recording a VBA macro to change some document property, then modify it to run through all the files in a given directory and process them. (All this assumes that you have a copy of Word with VBA installed.) > This must be a very common problem. Could be, and if it is there may already be a freeware/shareware app someplace that does this. Maybe even on msdn.microsoft.com James > > John > >