Home |
Search |
Today's Posts |
#1
|
|||
|
|||
WordCount Problem
hi,
Please excuse if I am in wrong group. Given following code fragment- -------------------------------------------- Words oWords = m_oDoc.GetWords(); long num = m_oDoc.ComputeStatistics(wdStatisticWords, COleVariant(long(FALSE))); *NumWords = oWords.GetCount(); if(*NumWords) { for(long i = 1; i= (*NumWords); i++) { Range word = oWords.Item(i); TRACE( word.GetText() ); Sleep( 100 ); WRITE_2_LOG_FILE_STRING( word.GetText() ); } } ---------------------------------------------------------------- I am trying to "process" a word document word by word. Why does here in above two function calls - 1. ComputeStatistics 2. Words.GetCount() ms word returns different count of words? ComputeStatistics return the same count as I get from the Tools-WordCount menu option, but GetCount() seams to be counting "many things" other then words. like ---- Given following URL as only text in a document [minus quotes]: "http://support.microsoft.com/kb/178749" ComputeStatistics counts it as 1 word but GetCount returns 11 My Second Question is how do I "tell" the oWords.Item(i) Method to give me words in "way ComputeStatistics method takes/counts" and "not the way GetCount Method takes"...? My intentention is to save a few processor cycle when processing the document "word by word" -- Regards, msjammu |
#2
|
|||
|
|||
You are in the wrong group.
Look for one with Word and VBA in the name, or Word and Programming. You'll get more and faster help with code there. On 9/15/05 11:40 AM, "msjammu" wrote: hi, Please excuse if I am in wrong group. Given following code fragment- -------------------------------------------- Words oWords = m_oDoc.GetWords(); long num = m_oDoc.ComputeStatistics(wdStatisticWords, COleVariant(long(FALSE))); *NumWords = oWords.GetCount(); if(*NumWords) { for(long i = 1; i= (*NumWords); i++) { Range word = oWords.Item(i); TRACE( word.GetText() ); Sleep( 100 ); WRITE_2_LOG_FILE_STRING( word.GetText() ); } } ---------------------------------------------------------------- I am trying to "process" a word document word by word. Why does here in above two function calls - 1. ComputeStatistics 2. Words.GetCount() ms word returns different count of words? ComputeStatistics return the same count as I get from the Tools-WordCount menu option, but GetCount() seams to be counting "many things" other then words. like ---- Given following URL as only text in a document [minus quotes]: "http://support.microsoft.com/kb/178749" ComputeStatistics counts it as 1 word but GetCount returns 11 My Second Question is how do I "tell" the oWords.Item(i) Method to give me words in "way ComputeStatistics method takes/counts" and "not the way GetCount Method takes"...? My intentention is to save a few processor cycle when processing the document "word by word" -- Daiya Mitchell, MVP Mac/Word Word FAQ: http://www.word.mvps.org/ MacWord Tips: http://www.word.mvps.org/MacWordNew/ What's an MVP? A volunteer! Read the FAQ: http://mvp.support.microsoft.com/ |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Comments and tables problem in Word 2003 | Microsoft Word Help | |||
Word Printing Problem | Microsoft Word Help | |||
Problem with Textboxes | Page Layout | |||
Attaching Expansion Pack to Word Documents - Puzzling Problem | Microsoft Word Help | |||
Word User Network Problem | Microsoft Word Help |