Как-то раз я психанул и составил процедуру, удаляющую все подсветки символов, абзацев, ячеек таблицы и всего этого внутри ячеек таблицы. Особенно полезно это для текста и и таблиц, скопированных из интернета.
Итак, поместите код в стандартный модуль. Выделите скопированный из инета текст или таблицу, затем запустите процедуру defill
Sub defill()
'
' Удаляет подсветку букв, текста, абзаца, ячеек, таблиц
' А теперь ещё и ставит чёрный цвет текста
StartUndoRecord "Удаление фона"
On Error Resume Next
If Selection.Type = wdSelectionIP Then
If MsgBox("Эта функция убирает цветной фон выделенного фрагмента. Сейчас ничего не выделено. Обработать весь текст?", vbYesNo + vbQuestion, "Ничего не выделено") = vbYes Then
DefillRange ActiveDocument.Content
End If
Else
DefillRange Selection.Range
End If
On Error GoTo 0
StopUndoRecord
End Sub
Sub DefillRange(rng As Range)
Dim aTable As Table
rng.Font.Color = wdColorAutomatic
With rng.ParagraphFormat
With .Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
End With
With rng.Font.Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
rng.HighlightColorIndex = wdNoHighlight
For Each aTable In rng.Tables
With aTable.Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
With aTable.Range.Cells.Shading
.Texture = wdTextureNone
.ForegroundPatternColor = wdColorAutomatic
.BackgroundPatternColor = wdColorAutomatic
End With
Next aTable
End Sub
Public Sub StartUndoRecord(Optional UR_name$ = "Какой-то макрос")
#If VBA7 Then
' для ВБА 7 (офис 2010) и выше
Application.UndoRecord.StartCustomRecord UR_name
#End If
End Sub
Public Sub StopUndoRecord()
#If VBA7 Then
Application.UndoRecord.EndCustomRecord
#End If
End Sub
Немножко спагетти-код, потому что главную процедуру я составил в 2011 году, для ворда 2003.
Назначьте на кнопку панели инструментов макрос defill.
Всем удачи в форматировании документов!