How can I remove the formatting from the "do not check spelling or grammar" across potentially hundreds of documents?

Anonymous
2025-02-26T00:30:16+00:00

Basically, I work at law firm and we have templates that we edit.

It looks like someone decided to added this formatting for a specific reason in one document and as people began copy and pasting from the template the formatting would be introduced to a new document and the formatting has spread in some capacity to vast majority of the documents we used and has led to errors.

My goal is to eradicate this formatting from our templates entirely as we have no use for it and the hazard of it spreading is way worse than any benefit from it. (I'm convinced it should just be removed from word all together at this point you can just ignore all or add to dictionary)

I know that I can find and replace it but we have far too many documents for it to be feasible and if I miss documents it may pop back up again.

I tried running a C# script with open XML but that leaves the paragraph markers with the formatting and if you press enter and start typing all of that newly typed text will have it.

I know that you can run a VBA or use C# with Microsoft.Interop but any of those scripts would have to open each document and i don't know if that would work.

Are there any ways to go about this that I'm missing? Or is there a way to make the open XML script apply to the paragraph markers? Any help would be greatly appreciated.

Thanks!

Microsoft 365 and Office | Word | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Anonymous
2025-03-09T20:36:51+00:00

Thanks so much for this!

We were able to use this as a base and edited it to include the headers and footers and go through folders and subfolder to check the documents. I would not have gone this route on VBA without your help! For some reason in my manual testing ctrl A and unchecking the button would result in the neutral box instead of it being unchecked but the code provided leaves it unchecked and removes it entirely.

This is the code we ended up getting to work (I have zero formal experience coding so it may be rough or there may be a better way, but this worked for our purposes):

Sub UncheckNoProofingInFolder()

' Charles Kenyon 2025-02-25

' Removes "No Proofing" from text in main body, headers, and footers

' Processes .doc and .docx files in a folder and its subfolders

'

Dim folderPath As String

' Prompt the user to select a folder

With Application.FileDialog(msoFileDialogFolderPicker)

    .Title = "Select Folder"

    .AllowMultiSelect = False

    If .Show = -1 Then ' If the user selects a folder

        folderPath = .SelectedItems(1) & "\"

    Else

        MsgBox "No folder selected. Macro will exit."

        Exit Sub

    End If

End With

' Call the recursive function to process the folder and subfolders

ProcessFolder folderPath

MsgBox "All documents have been processed successfully."

End Sub

Sub ProcessFolder(folderPath As String)

Dim fileName As String

Dim subfolder As String

Dim doc As Document

' Process all .docx files in the current folder

fileName = Dir(folderPath & "\*.docx")

On Error GoTo ErrorInDoc

Do While fileName <> ""

    ' Open the document

    Set doc = Documents.Open(folderPath & fileName)

    ' Remove "No Proofing" from main body, headers, and footers

    RemoveNoProofing doc

    ' Save and close the document

    doc.Save

    doc.Close

    ' Move to the next file

    fileName = Dir

Loop

' Process all .doc files in the current folder

fileName = Dir(folderPath & "\*.doc")

Do While fileName <> ""

    ' Open the document

    Set doc = Documents.Open(folderPath & fileName)

    ' Remove "No Proofing" from main body, headers, and footers

    RemoveNoProofing doc

    ' Save and close the document

    doc.Save

    doc.Close

    ' Move to the next file

    fileName = Dir

Loop

' Check for subfolders and process them

subfolder = Dir(folderPath & "\*", vbDirectory)

Do While subfolder <> ""

    If subfolder <> "." And subfolder <> ".." Then

        If (GetAttr(folderPath & subfolder) And vbDirectory) = vbDirectory Then

            ' Call ProcessFolder recursively for each subfolder

            ProcessFolder folderPath & subfolder & "\"

        End If

    End If

    subfolder = Dir

Loop

Exit Sub

ErrorInDoc:

MsgBox "There was an error processing the document: " & fileName

On Error GoTo -1

End Sub

Sub RemoveNoProofing(doc As Document)

Dim headerFooter As headerFooter

Dim section As section

' Remove "No Proofing" from the main body

doc.Content.NoProofing = False

' Remove "No Proofing" from headers and footers

For Each section In doc.Sections

    For Each headerFooter In section.Headers

        headerFooter.Range.NoProofing = False

    Next headerFooter

    For Each headerFooter In section.Footers

        headerFooter.Range.NoProofing = False

    Next headerFooter

Next section

End Sub

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments
Answer accepted by question author
Charles Kenyon 172K Reputation points Volunteer Moderator
2025-02-26T03:02:11+00:00

Yes. You can use a bulk vba processor. Here are two free ones.

These will run a process that you define on every document in a folder.

Here is a simple macro:

Sub UncheckNoProofing()

    ' Charles Kenyon 2025-02-25

    ' https://answers.microsoft.com/en-us/msoffice/forum/all/how-can-i-remove-the-formatting-from-the-do-not/76f9d810-7424-4aa7-93b6-6c0ad6237ea8

    ' Removes "No Proofing" from text in main body of document

    ' Does not reach headers, footers, or textboxes

    '

    On Error GoTo ErrorInDoc

    Selection.WholeStory

    Selection.NoProofing = False

    ActiveDocument.Save

    GoTo EndOfSub

ErrorInDoc:

    MsgBox "There was an error processing the document: " & ActiveDocument.fullname

EndOfSub:

    On Error GoTo -1

    ActiveDocument.Close

 End Sub

As stated in the comments, this gets text in the main body of the document, but not in headers, footers, or textboxes. If you really need it to reach that text as well, it can be done but will make for a more complex macro and can increase the processing time.

There are very good reasons for this marking of text. When you save a word in your dictionary (your list of acceptable spellings) it will not be marked as a problem on your computer. If you take the same document to another computer or send it to someone, it will be marked as a misspelling, though, unless the word is in the list on that computer. When you mark it to not check spelling or grammar, it will not show up as a misspelling in Word on any computer.

And yes, I do understand your frustration. Since it is invisible and can be imported with pasted text, it can seem like a virus.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Charles Kenyon 172K Reputation points Volunteer Moderator
    2025-02-27T15:23:50+00:00

    Do you need more assistance with this?

    Was this answer helpful?

    0 comments No comments