I need code to force spell check on all fields (format)

B

BABs

I have reports that are built from a template with many fields that pull data
from excel. I just noticed that the inserted fields default to " do not
spell check" just like date and page fields. I can go through the replace
command (format-language) to change the field format from "do not spell
check" to "spell check", but I would like to write the code to do this once
the document is created. Is this possible and if so, how?
I already have the document open and do
.fields.update
.fields.unlink
before saving.

Thx a million,
 
J

Jean-Guy Marcil

BABs said:
I have reports that are built from a template with many fields that pull data
from excel. I just noticed that the inserted fields default to " do not
spell check" just like date and page fields. I can go through the replace
command (format-language) to change the field format from "do not spell
check" to "spell check", but I would like to write the code to do this once
the document is created. Is this possible and if so, how?
I already have the document open and do
.fields.update
.fields.unlink
before saving.

If you want to change that status only for the fields and leave the rest of
the document as is, try this:

Dim docOpen As Document
Dim i As Long

Set docOpen = ActiveDocument

With docOpen
.Fields.Update
If .Fields.Count > 0 Then
For i = 1 To .Fields.Count
.Fields(i).Result.NoProofing = False
Next
End If
.Fields.Unlink
End With


However, since you are unlinking the fields, you could do it like that as
well, but the whole document will become "active" for spell checking:

Dim docOpen As Document

Set docOpen = ActiveDocument

With docOpen
.Fields.Update
.Fields.Unlink
.Range.NoProofing = False
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top