DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Ruby & MS Word: Counting Words And Pages
From the <a href="http://rubyonwindows.blogspot.com">Ruby on Windows</a> blog...
require 'win32ole'
WdStatisticWords = 0
WdStatisticPages = 2
word = WIN32OLE.connect('Word.Application')
doc = word.ActiveDocument
word_count = doc.ComputeStatistics(WdStatisticWords)
page_count = doc.ComputeStatistics(WdStatisticPages)
Further details <a href="http://rubyonwindows.blogspot.com/2009/06/ruby-word-counting-words-and-pages.html">here</a>.





