#1   Report Post  
msjammu
 
Posts: n/a
Default 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   Report Post  
Daiya Mitchell
 
Posts: n/a
Default

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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comments and tables problem in Word 2003 Ann Scharpf Microsoft Word Help 0 April 28th 05 04:38 PM
Word Printing Problem Nick Demetriou Microsoft Word Help 5 April 7th 05 12:15 AM
Problem with Textboxes Gary McGill Page Layout 10 March 31st 05 03:23 PM
Attaching Expansion Pack to Word Documents - Puzzling Problem Jose Microsoft Word Help 1 March 3rd 05 10:14 AM
Word User Network Problem Alpine Tom Microsoft Word Help 1 December 17th 04 04:51 PM


All times are GMT +1. The time now is 07:06 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"