Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Drawing and Graphics

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-08-2011, 02:56 PM
Ulodesk Ulodesk is offline Windows 7 32bit Office 2007
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 764
Ulodesk is on a distinguished road
Default Tables that carry hidden para styles

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
Attached Files
File Type: doc Table issue.doc (61.0 KB, 2 views)
Reply With Quote
  #2  
Old 03-08-2011, 10:29 PM
macropod's Avatar
macropod macropod is offline Windows 7 32bit Office 2000
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,476
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

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
[MS MVP - Word]
Reply With Quote
  #3  
Old 03-09-2011, 08:07 AM
Ulodesk Ulodesk is offline Windows 7 32bit Office 2007
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 764
Ulodesk is on a distinguished road
Default The evidence

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
Reply With Quote
  #4  
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: 19,476
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
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
[MS MVP - Word]
Reply With Quote
  #5  
Old 03-10-2011, 08:16 AM
Ulodesk Ulodesk is offline Windows 7 32bit Office 2007
Word 2013 Expert Cert
 
Join Date: Sep 2009
Location: Virginia
Posts: 764
Ulodesk is on a distinguished road
Default Trying again

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
Attached Files
File Type: doc Table Conundrum.doc (141.5 KB, 3 views)
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Carry-forward: Tab to Tab? 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


All times are GMT -7. The time now is 11:48 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft