From: Inge Zwart Date: 2007-08-23T07:50:37+09:00 Subject: Re: Ruby & Word 2007 help Craig, Thanks for your e-mail. It is stopping at the Open command - it opens Word but then doesn't load the first document. I'm running a macro on a bunch of Word documents that sets the paper trays for printing. Thanks again for your help. Inge Inge H. Zwart, RN, BSN TeleTrans, Inc. Medical Transcription Specialists since 1989 Phone: 623-505-4423 / 877-495-9041 Fax: 623-505-4423 -----Original Message----- From: Craig Demyanovich [mailto:cdemyanovich@gmail.com] Sent: Wednesday, August 22, 2007 2:34 PM To: ruby-talk ML Subject: Re: Ruby & Word 2007 help I'm not sure I can help, but I'm interested in what you're doing. However, you didn't provide details of the failure(s); please do so. Craig On 8/22/07, Inge Zwart wrote: > > I have a batchmacro that I use in Ruby with Word 2003. I converted to > Word > 2007 and now it doesn't work. Can anyone tell me how to change the code? > The code is below: > > > # batchmacro.rb > # Ruby script for batch running Word macros > > require 'win32ole' > > # Launch new instance of Word > wrd = WIN32OLE.new('Word.Application') > > wrd.Visible = 1 > > # First argument to script is the name of the macro > macro1 = ARGV.shift() > > # Everything else is a document on which to run the macro > ARGV.each do |file| > doc = wrd.Documents.Open(File.expand_path(file)) > wrd.Run(macro1) > doc.Save() > doc.Close() > end > > wrd.Quit() > >