From: Heesob Park Date: 2008-12-12T17:54:54+09:00 Subject: Re: How to Count pages in a word document Hi, 2008/12/12 Talib Hussain : > Hi, > > Could you let me know how can I count the no. of pages in a Word > document using Ruby? > Try this: require 'win32ole' word = WIN32OLE.new('word.application') file = 'c:/work/test.doc' doc = word.documents.open(file,'ReadOnly' => true) page = doc.ComputeStatistics(2) # wdStatisticPages = 2 word.activedocument.close(false) word.quit puts page HTH, Park Heesob