View Single Post
 
Old 03-09-2011, 05:28 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Ulodesk,

There was no file attached to your last post, and the attachment to the previous one didn't include either an offending table or an indication of what unwanted Styles it imports.

I can't see why, given that the macro deletes all user-defined Styles, the "the majority of the invaders" would remain in the document after the macro has run. To retain your own user-defined Styles, whose names you say all being with 'K', doesn't take much extra code:
Code:
Sub CleanUpStyles()
Dim oSty As Style
For Each oSty In ActiveDocument.Styles
  With oSty
    If .BuiltIn = False Then
      If Left(.NameLocal, 1) <> "K" Then .Delete
    End If
  End With
Next
End Sub
As for the Styles that are "in altered states from authors' machinations", you can remedy that during the paste operation that inserts the tables, by setting Word's paste options for pasting between documents to 'match destination formatting'. See under Word Options|Advanced > Cut, copy & paste.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote