Consulting

Page 2 of 2 FirstFirst 1 2
Results 21 to 24 of 24

Thread: Solved: Problem with GoToNext(what:=wdGoToSpellingError)

  1. #21
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    I find that hard to believe as well!

    I must mentione that I've never encountered a document that has those many word's in them that aren't in the dic or are a spelling error.

    So that's why I've probably never asked my self this question because there was no need for it..

    But like you it's still on my mind what a possible sollution will look like...

    I'll keep on trying stuff for yah!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  2. #22
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    Modifying my previous code to include the code below does seem to imply that any reference to a collection of ProofReadingErrors does cause the collection to be rebuilt each time.

    I am trying to treat yourErrors as an already built collection and retrieving the ranges that way.

    But the time for that loop is almost identical to the time for the 2nd loop in which I explicitly ask for a single member of SpellingErrors each time. In this case, Word is very likely rebuilding the collection each time.

    Also, you can see the same behavior for my code samples with much smaller documents, but the absolute time differences are not as large so the issue does not get noticed unless one is looking for this type of detail.

    	' yourErrors should now contain the collection of spelling errors.
    	
    	QueryPerformanceCounter curQPStart
    	ReDim rngSpellingError(lngSpellingErrorCount - 1)
    	For i = 0 To lngSpellingErrorCount - 1
    		Set rngSpellingError(i) = yourErrors(i + 1)
    	Next i
    	QueryPerformanceCounter curQPEnd
    	lngTime = (curQPEnd - curQPStart) / dblQPFreq * 1000
    	Debug.Print "Copying ranges from collection: " & lngTime
    	
    	QueryPerformanceCounter curQPStart
    	ReDim rngSpellingError(lngSpellingErrorCount - 1)
    	With ActiveDocument.Content
    		For i = 0 To lngSpellingErrorCount - 1
    			Set rngSpellingError(i) = .SpellingErrors(i + 1)
    		Next i
    	End With
    	QueryPerformanceCounter curQPEnd
    	lngTime = (curQPEnd - curQPStart) / dblQPFreq * 1000
    	Debug.Print "Using ActiveDocument.Content, Copying ranges from collection: " & lngTime

  3. #23
    VBAX Mentor
    Joined
    Sep 2004
    Location
    Nashua, NH, USA
    Posts
    489
    Location
    I posted a summary of this problem in a MSFT newsgroup yesterday.

    Got the expected response.

    MSFT's ill conceived implementation of the ProofReadingErrors collection does appear to cause the collection to be recalculated when accessing a member of the collection.

    Somebody mentioned that there is a paper on this somewhere.
    If I find the paper, I'll let y'all know.

    So fer now, I'll mark this thread as Solved, with a very unsatisfactory ending.

  4. #24
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Yes indeed unsatisfactory when you've spended as much time as you have!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •