Hi Everyone,
when am executing a mail merge via vba,
the final document does not have the red wavy spellcheck lines.
a) i went to tool/options/spelling and grammar
and : hide spelling is unchecked
b) then went to tool/options
and do not check spelling and grammar is checked off.
c) then went to google to search for spell checking using vba
massaged someone else's code to come up with these 2 attempts.
(i'm still a beginner with vba)
1) attempt #1
Debug.Print rng.SpellingErrors.Count
it's showing 0, and there are spelling error
2) attempt #2 - for does not execute bec it thinks there are no spelling errors
Set oSpErrors = rng.SpellingErrors
For Each oSpError In oSpErrors
Debug.Print oSpError.Text
With rng.Find
.Text = oSpError.Text
If .Execute Then
wrd.Font.Underline = wdUnderlineWavy
wrd.Font.UnderlineColor = wdColorRed
End If
End With
Next oSpError
3) attempt #3 - almost works
I) but: the word: percenttttt is not triggering a wavy line
(could it be bec it's not in the suggestions "dictionary"?
the word: ogans is triggering a wavy line
II) checking each word in the doc is slow
III) any way that names of people not be spell checked?
For Each wrd In DocB.Range.Words
With wrd.Find
.MatchWildcards = True
.Text = "[a-zA-Z]{1,}" 'only test alphabetic
If .Execute Then
Set sugs = GetSpellingSuggestions(wrd.Text)
If sugs.Count > 0 Then
wrd.Font.Underline = wdUnderlineWavy
wrd.Font.UnderlineColor = wdColorRed
Debug.Print wrd.Text
Else
wrd.Font.Underline = wdUnderlineNone
End If
End If
End With
Next wrd
Have you done this before, tx for your help, sandra
[Non-text portions of this message have been removed]
| Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (1) |
Tidak ada komentar:
Posting Komentar