Hey guys. Playing around here, and trying to count the words in a MS Word document. It is returning a number, but not the amount of words in the doc, as when I open it up using word, and look at the count there, it is a few off from when I use the object. Maybe I am going it wrong.
I created a small document. I open it in the object and do the count (which I think I am going it right), and the total count is returned as 18. I open the document in Word, do a count, says I have 14 words. Very odd. I am using Word 2000 and CFMX. Also, anyone know how I can get the total pages, document name, paragraphs, etc... that word gives you on the word count box? not seeing much information on it online, and stumbled up on the count by mistake, so it may be not what I am trying to do. I just need a realistic count. The document does have 14 words, as I counted it myself, not sure why when using the code below it says I have 18 words. Here is the code. Thanks for any help! <CFTRY> <CFOBJECT ACTION="CONNECT" CLASS="Word.Application" NAME="objWord" TYPE="COM"> <CFCATCH> <CFOBJECT ACTION="CREATE" CLASS="Word.Application" NAME="objWord" TYPE="COM"> </CFCATCH> </CFTRY> <CFSCRIPT> OpenDoc = objWord.Documents.Open("c:\blah.doc"); Count = opendoc.words.count(); OpenDoc.Close(); objWord.Quit(); objWord = "Nothing"; </CFSCRIPT> <CFOUTPUT> COUNT: #count# </CFOUTPUT> Thanks! Robert Bailey Famous for nothing ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4