Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Dec 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Highlighting misspelled words (2003-SP1)

    Hi all,
    I am looking for a routine to change the highlighting of misspelled words from squiggly red to e.g. yellow background. In other discussion boards I found some routines based on a Range object which is very time consuming.
    Does anybody know a faster alternative? Any advice is highly appreciated.

    Happy Easter holidays!
    Andreas

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Highlighting misspelled words (2003-SP1)

    If the number of spelling errors in a document is large, any method will be very slow. The following method should theoretically be fast, because it only looks at misspelled words instead of inspecting every word in the document, but I found it to be excruciatingly slow if there are many spelling errors. With a moderate number of errors, performance is acceptable.

    Sub HighlightSpellingErrors()
    Dim colErrors As ProofreadingErrors
    Dim rngErr As Range
    Dim lngErrCount As Long

    Set colErrors = ActiveDocument.SpellingErrors
    lngErrCount = colErrors.Count
    If lngErrCount > 0 Then
    If MsgBox("There are " & lngErrorCount & " error(s)." & _
    vbCrLf & "Do you want to highlight all of them?", _
    vbYesNo + vbQuestion) = vbYes Then
    Application.ScreenUpdating = False
    For Each rngErr In colErrors
    rngErr.HighlightColorIndex = wdRed
    Next rngErr
    Application.ScreenUpdating = True
    End If
    End If

    Set rngErr = Nothing
    Set colErrors = Nothing
    End Sub

  3. #3
    New Lounger
    Join Date
    Dec 2003
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Highlighting misspelled words (2003-SP1)

    Hi Hans,

    many thanks for your help with the macro. I agree with you, for long documents it is very slow.
    Actually, my intention was it to have a macro which highlights errors on the fly, but I fear this is not possible in Word. Am I right?

    Best regards,
    Andreas

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Highlighting misspelled words (2003-SP1)

    It might be possible to do so, but I think it would be extremely difficult to get it to work correctly in all circumstances, and it would probably slow down Word too much.

Posting Permissions

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