Replace style in all tables in a word document.
Hello everyone.
I am trying to generate a macro code that will allow me to change all the styles in a word document. What seemed to me to be a simple function, it is starting to get really complicated since I can't manage to get it working.
So, I have googled what I thought it would be a perfect function:
Sub ApplyTableStyle()
Dim t As Table
For Each t In ActiveDocument.Tables
t.Style = "Light Shading - Accent 3"
Next
End Sub
And it changed the style of some of the tables, but not all of them. Some of the tables I have to click them individually and change its style individually.But I can only do it if I select the option "Apply and clear formatting" If I choose "Apply and maintain formating" it doesn't do anything.
Is there any way of overcoming this?
I have tried in two different laptops and it happens on both.. This document wasn't generated by me in the first place.. so Is there any way of clearing all the "nonsense" and do this from scratch?
Any ideas?
Thank you very much.
Regards,
Edgar
|