Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / April 2006

Tip: Looking for answers? Try searching our database.

Misspelling Vs. Duplicate

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ricardo Muiz - 19 Apr 2006 04:09 GMT
In VBA, how can you tell a misspelling from a duplicated word (a word marked
as a misspelling because it is repeated)? It appears programmatically Word
marks these two cases as the same even though the user interface clearly
knows the difference (since a different set of buttons become active).
Jay Freedman - 20 Apr 2006 02:59 GMT
Hi Ricardo,

The following demo shows how to distinguish the cases. The name of the
constant wdSpellingCorrect is unfortunate -- if the item was really
correct, it wouldn't be in the SpellingErrors collection.

Sub SpellDemo()
   Dim msg As String
   Dim rgError As Range
   Dim suggs As SpellingSuggestions
   
   For Each rgError In ActiveDocument.SpellingErrors
       Set suggs = rgError.GetSpellingSuggestions
       
       Select Case suggs.spellingErrorType
           Case wdSpellingCorrect:
               msg = "Repeated word"
           Case wdSpellingNotInDictionary:
               msg = "Not in dictionary"
           Case wdSpellingCapitalization:
               msg = "Incorrect capitalization"
       End Select
       
       rgError.Select
       MsgBox msg
   Next
End Sub

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>In VBA, how can you tell a misspelling from a duplicated word (a word marked
>as a misspelling because it is repeated)? It appears programmatically Word
>marks these two cases as the same even though the user interface clearly
>knows the difference (since a different set of buttons become active).
Ricardo Muiz - 20 Apr 2006 04:19 GMT
Thanks. I'm not sure I would have found that on my own.

> Hi Ricardo,
>
[quoted text clipped - 35 lines]
> >marks these two cases as the same even though the user interface clearly
> >knows the difference (since a different set of buttons become active).
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.