![]() |
|
#1
|
|||
|
|||
![]() I am attaching a word doc explaining at some length, for those interested, a perplexing phenomenon which I have encountered several times in my professional proposal work. In essence, an extremely long table appears to carry umpteen styles with it and resists efforts at clearing them. Perhaps a few experts may have some useful insights. Best, Ulo |
#2
|
||||
|
||||
![]()
Hi Ulodesk,
Here's a macro you might find useful. It simply goes through all the Styles in the active document and deletes any user-defined ones. Any paragraph using a deleted paragraph Style will revert to the Normal Style and anything using a deleted character Style should revert to the underlying paragraph Style. Code:
Sub CleanUpStyles() Dim oSty As Style For Each oSty In ActiveDocument.Styles If oSty.BuiltIn = False Then oSty.Delete Next End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Dear Paul,
Thank you for the macro, which I installed and ran. What it did, as far as I could see, was delete all the proper custom styles in the document, which were from our template, and leave at least the majority of the invaders. In case you'd like to pursue this little gremlin further, I am attaching a copy of part of the table (the whole thing is too large), with original text replaced. The styles that begin with K are the styles we use, along with the adapted built-in headings and a handful of others; they number about 60-75, depending on adaptation of template to particular needs. As you'll see, some are already in altered states from authors' machinations. The rest came in with the table. Interestingly, taking just this part of the table and putting it in this new doc for you, knocked most of the numbered heading styles silly. Ours look like 1 (sans bullet) and then like level 4. Cordially, Ulodesk |
#4
|
||||
|
||||
![]()
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
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Paul,
My thanks again for your contribution. Here's the file I intended to attach last round. I think it will help clarify the issues. I'll run your new macro later today, when I get a chance, and let you know how it fares with this gremlin. Thank you! For the moment, let me just add that I am aware of the cut-and-paste options. I didn't write clearly what I meant about styles in altered states. I was referring to two aspects, principally: 1. a para style turned into a linked style; 2. the style name becoming a tangle (e.g., "KBody_text,bt" becoming "KBody_text,bt,Body_Text,KBody_Text,kea_bt Paragraph_Text, AMBodyText,mo_bt,KBody_TextChar,KResumeBody_text") . Neither of these aspects is "blocked" by selecting Destination formatting in the paste options; only bringing in text as unformatted keeps the new document clean. I have tried a couple of times to teach myself VBA, but it remains a secondary need in demands on my time; I've not yet gotten far. I'm very grateful for your generous expertise. Best wishes, Ulodesk |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
markg2 | Excel | 11 | 01-30-2011 01:07 AM |
Hidden address | nicolapiva | Outlook | 2 | 11-16-2010 12:12 AM |
Don't count hidden slides | Lu_Argentina | PowerPoint | 0 | 10-12-2010 02:12 PM |
Can I carry Outlook 2007 with me on a usb stick? | Hansio | Outlook | 2 | 09-09-2010 01:29 PM |
hidden blank pages | mljm | Word | 3 | 06-19-2009 03:18 AM |