Reputation: 3291
I want to loop through my word document removing all backgroundcolors on each word. This is my code so far but it is not working - I get the following error message "Argument not optional" and ".Item" is highlighted:
Sub ResetColor()
Dim doc As Document
Set doc = ActiveDocument
Set eword = doc.Range.Words.Item
For i = 1 To doc.Range.Words
eword.Shading.Texture = wdTextureNone
eword.Shading.ForegroundPatternColor = wdColorAutomatic
eword.Shading.BackgroundPatternColor = wdColorAutomatic
Next
End Sub
Upvotes: 0
Views: 988
Reputation: 11283
Try this:
Sub ResetColor()
Dim doc As Document
Set doc = ActiveDocument
For Each eword In doc.Range.Words
eword.Shading.Texture = wdTextureNone
eword.Shading.ForegroundPatternColor = wdColorAutomatic
eword.Shading.BackgroundPatternColor = wdColorAutomatic
Next
End Sub
Upvotes: 1