I call them Frankenstyles
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
My ideas on Evil Word Char Char Styles (2002)
Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » My ideas on Evil Word Char Char Styles (2002)
- This topic has 32 replies, 6 voices, and was last updated 21 years, 1 month ago.
AuthorTopicWSChristie
AskWoody LoungerJanuary 30, 2004 at 9:25 pm #400000Viewing 3 reply threadsAuthorReplies-
WSLauraT
AskWoody LoungerFebruary 2, 2004 at 8:51 pm #777984Christie,
FWIW:
This is very interesting. I’ve been wrestling with this Char char char madness for some time now in templates I created that insert auto text. I posted about this in another thread and the moderator directed me to your post.
I had just discovered that (somehow) this char char style had gotten on my Body Text style in a global template. This template file is very large and contains a lot of macros and forms. INTERESTINGLY — when I would edit the template and save it, it would take, literally, 15-20 seconds to save sometimes.
After reading your post, I went into the organizer and deleted the body text style which WAS of type paragraph AND character! (I had NEVER noticed that), and then redefined Body Text as I wanted it.
The template now saves as fast as any other document, and is almost 1/2 mg. smaller in size.
-
WSLauraT
AskWoody LoungerFebruary 2, 2004 at 8:51 pm #777985Christie,
FWIW:
This is very interesting. I’ve been wrestling with this Char char char madness for some time now in templates I created that insert auto text. I posted about this in another thread and the moderator directed me to your post.
I had just discovered that (somehow) this char char style had gotten on my Body Text style in a global template. This template file is very large and contains a lot of macros and forms. INTERESTINGLY — when I would edit the template and save it, it would take, literally, 15-20 seconds to save sometimes.
After reading your post, I went into the organizer and deleted the body text style which WAS of type paragraph AND character! (I had NEVER noticed that), and then redefined Body Text as I wanted it.
The template now saves as fast as any other document, and is almost 1/2 mg. smaller in size.
-
Andrew Lockton
AskWoody_MVPMarch 30, 2004 at 12:29 pm #778063I will add a few of my random thoughts …
I prefer to call them Dancing Styles (as in Slide Slide Char Char Char). They can grow larger than a style name allows (256 characters I think) which will then give a funny result that a second hidden style with the same name gets created but can’t be seen in anything other than a RTF file. If you delete a style with a hidden one behind it, the hidden one can then be seen, which makes it appear that the delete didn’t happen. If you delete the second one then it really gets deleted.
I can also demonstrate a couple of ways to create a dancing style (frankenstyle) without leaving Word 2002.
Select a part of a paragraph within a table and apply another paragraph style (eg Heading 1)
Add the table as a new autotext entry
Insert the autotext entry back into the file
That gives me a “Heading 1, Heading 1 Char” style
In a previous thread Terri Gerlich (tgerlich – post 259228) also mentions using the clipboard task pane rather than an autotext entry will do the same thing.I can remove most of the problems once started by running a macro which removes all style aliases. This macro, whilst not originally created to resolve the dancing styles, is quite effective in reducing the problem before it goes too far. The macro looks like this
Sub RemoveAllStyleAliases() Dim aStyle As Variant, iPos As Integer For Each aStyle In ActiveDocument.Styles iPos = InStr(1, aStyle, ",") If iPos 0 Then aStyle = Left(aStyle, iPos - 1) On Error Resume Next ActiveDocument.Styles(aStyle).NameLocal = aStyle On Error GoTo 0 End If Next aStyle End Sub
This macro should not be used if you are at all attached to other style aliases. A macro has now been posted by Gary Frieder – post 357927 which is more specific to resolving the char styles created as links to an existing paragraph style.
Knowing what causes the problem, avoiding these runaway styles in the first place appears to be easy enough – never apply paragraph styles to anything less than a full paragraph (easier said than done). You should have less problems if you avoid applying local formatting where possible and primarily relying on paragraph styles for formatting.
-
WSLauraT
AskWoody LoungerFebruary 3, 2004 at 5:38 am #778178Your post was also very helpful. (Although I can’t quite bring myself to refer to it as something so benign sounding as a “dancing style!”)
I know I first got into trouble with these with a template I created that held several auto text entries, and it was when the auto text entries were inserted back into the document that the Char Char styles reared their ugly heads. I too never apply local formatting — but I was creating the auto text based on text/tables set up by someone else who might not have known that apply a paragraph style to part of a paragraph results in character formatting.
What really threw me about this is that the Body Text, Char Char Char style appeared in the styles and formatting task pane after I inserted the auto text, but when I moved through the auto text I couldn’t FIND the style applied anywhere.
Arrrggg! But now I understand much better what’s going on and will give your code a whirl. Thanks!
Laura
-
WSLauraT
AskWoody LoungerFebruary 3, 2004 at 5:38 am #778179Your post was also very helpful. (Although I can’t quite bring myself to refer to it as something so benign sounding as a “dancing style!”)
I know I first got into trouble with these with a template I created that held several auto text entries, and it was when the auto text entries were inserted back into the document that the Char Char styles reared their ugly heads. I too never apply local formatting — but I was creating the auto text based on text/tables set up by someone else who might not have known that apply a paragraph style to part of a paragraph results in character formatting.
What really threw me about this is that the Body Text, Char Char Char style appeared in the styles and formatting task pane after I inserted the auto text, but when I moved through the auto text I couldn’t FIND the style applied anywhere.
Arrrggg! But now I understand much better what’s going on and will give your code a whirl. Thanks!
Laura
-
WSChristie
AskWoody Lounger -
WSLauraT
AskWoody LoungerFebruary 3, 2004 at 7:22 pm #778407(Edited by HansV to make URL clickable – see Help 19)
Hi,
I read on another forum ( http://groups.google.com/groups?selm=eNGpP…FTNGP11.phx.gbl%5B/url%5D ) that the service packs greatly reduce this problem.
Maybe you have a more recent service pack so yours is behaving better.
Myself, I’d yet to install the service pack, but will do so now!Laura
-
WSChristie
AskWoody LoungerFebruary 3, 2004 at 6:51 pm #778415Hi Laura,
Thanks for that info and link — I wasn’t aware of the google forum, but that’s now added to my favorites for when I have to research the various and sundry Word problems that always find their way to me for resolution.
That is interesting about the service packs minimizing the problem, I wonder if that just prevents the styles from bugging out within 2002, as in the AutoText and Clipboard issue Andrew described. When I get a chance, I will re-test taking a 2002 document with linked styles into a lower version of Word for editing and return to 2002, since I have all the SPs and patches installed (can you say overzealous?).
Christie
-
WSChristie
AskWoody LoungerFebruary 3, 2004 at 6:51 pm #778416Hi Laura,
Thanks for that info and link — I wasn’t aware of the google forum, but that’s now added to my favorites for when I have to research the various and sundry Word problems that always find their way to me for resolution.
That is interesting about the service packs minimizing the problem, I wonder if that just prevents the styles from bugging out within 2002, as in the AutoText and Clipboard issue Andrew described. When I get a chance, I will re-test taking a 2002 document with linked styles into a lower version of Word for editing and return to 2002, since I have all the SPs and patches installed (can you say overzealous?).
Christie
-
-
WSLauraT
AskWoody LoungerFebruary 3, 2004 at 7:22 pm #778408(Edited by HansV to make URL clickable – see Help 19)
Hi,
I read on another forum ( http://groups.google.com/groups?selm=eNGpP…FTNGP11.phx.gbl%5B/url%5D ) that the service packs greatly reduce this problem.
Maybe you have a more recent service pack so yours is behaving better.
Myself, I’d yet to install the service pack, but will do so now!Laura
-
Andrew Lockton
AskWoody_MVPFebruary 3, 2004 at 11:01 pm #778547Christie
Have you tried it with the offending text inside a table cell? That is where I originally saw it and how I tested it when I posted the instructions. I deleted the fact that my text was inside a table cell because Terri didn’t mention it as a factor. When I first came across the problem, the users were using tables stored as autotext and each time they added a table, the style name grew longer. This quickly reached the limit and a phantom one was created so the pattern could continue but Word was incapable of displaying the phantom style by itself.
A complicating factor with that client was that table styles (also new in Word 2002) were overriding the paragraph styles and the table styles applied themselves without the users actually applying them directly. This meant that paragraph text inside a table was formatted differently from the same styled text outside the table even though there was no local formatting on either location (verified by Ctrl-Q and Ctrl-Space).
My Word version is 2002 (10.5522.4219) SP-2. What version do you have running?
-
WSLauraT
AskWoody LoungerFebruary 4, 2004 at 4:27 am #778644Andrew —
This is EXACTLY what I was doing — putting tables in auto text (w/ bookmarks and text inside of them) and then inserting them (w/ vba code) into the document. I applied the tableNormal style to the table, but had to modify a border or two.
I lost HOURS watching word crash when I tried to redefine auto text, and trying to “start over from scratch” to avoid the evil styles.
MADNESS!!!
Laura -
WSLauraT
AskWoody LoungerFebruary 4, 2004 at 4:27 am #778645Andrew —
This is EXACTLY what I was doing — putting tables in auto text (w/ bookmarks and text inside of them) and then inserting them (w/ vba code) into the document. I applied the tableNormal style to the table, but had to modify a border or two.
I lost HOURS watching word crash when I tried to redefine auto text, and trying to “start over from scratch” to avoid the evil styles.
MADNESS!!!
Laura -
WSChristie
AskWoody LoungerFebruary 13, 2004 at 11:30 pm #784255Hi Andrew,
I finally got a chance to test this some more, but I still don’t get the automatic compounding of styles. I tried it with the text in a table, making autotext entries, and cutting/copying with the clipboard. You and I are running the same version of Word, I am on Windows XP. I sure wish I could recreate this and see it for myself, sigh! Interesting about the table styles, too — I have not seen them automatically apply themselves. Was the client having all these problems running any custom templates and macros that may have triggered unusual behavior?
Christie
-
WSChristie
AskWoody LoungerFebruary 13, 2004 at 11:30 pm #784256Hi Andrew,
I finally got a chance to test this some more, but I still don’t get the automatic compounding of styles. I tried it with the text in a table, making autotext entries, and cutting/copying with the clipboard. You and I are running the same version of Word, I am on Windows XP. I sure wish I could recreate this and see it for myself, sigh! Interesting about the table styles, too — I have not seen them automatically apply themselves. Was the client having all these problems running any custom templates and macros that may have triggered unusual behavior?
Christie
-
-
Andrew Lockton
AskWoody_MVPFebruary 3, 2004 at 11:01 pm #778548Christie
Have you tried it with the offending text inside a table cell? That is where I originally saw it and how I tested it when I posted the instructions. I deleted the fact that my text was inside a table cell because Terri didn’t mention it as a factor. When I first came across the problem, the users were using tables stored as autotext and each time they added a table, the style name grew longer. This quickly reached the limit and a phantom one was created so the pattern could continue but Word was incapable of displaying the phantom style by itself.
A complicating factor with that client was that table styles (also new in Word 2002) were overriding the paragraph styles and the table styles applied themselves without the users actually applying them directly. This meant that paragraph text inside a table was formatted differently from the same styled text outside the table even though there was no local formatting on either location (verified by Ctrl-Q and Ctrl-Space).
My Word version is 2002 (10.5522.4219) SP-2. What version do you have running?
-
WSLauraT
AskWoody LoungerFebruary 6, 2004 at 11:39 pm #780225Hi Christie,
I wanted to ask — you mentioned using the organizer to copy in the correct style — this is what I’ve been doing programmatically (and sometimes manually). One thing I noticed though is that this does NOT change the style type back to PARAGRAPH, it remains a PARAGRAPH AND CHARACTER style. (Same with Andrew’s code to trip the aliases) Do you think this is anything to be concerned about?
The documents are behaving, but that “paragraph AND character” style type is REALLY bugging me — now that I know it exists…
Thanks
Laura -
WSChristie
AskWoody LoungerFebruary 14, 2004 at 12:22 am #784271Hi Laura,
Interesting — I hadn’t encountered that since all the “frankenstyle” documents I have dealt with have gotten that way from being edited in previous versions of Word, so the style linking is gone.
I would think your documents would be fine as long as the triggers for creating the problem styles don’t occur — text formatted with the char style being edited in a previous Word version, or the issue with autotext in tables or used with the clipboard (which I can’t reproduce, no matter how hard I try). I did find that deleting the char style from the organizer will break the link, although I get an error message that it can’t be deleted, but when I check the task pane the linking is gone, and returning to the organizer the char style is no longer listed. So if it really bugs you to have them there, it looks like deleting the the char styles would do the trick.
I haven’t worked with VBA code on this issue, but check out Mesaka’s post in a similar thread, although you have probably already read it.
Christie
-
WSChristie
AskWoody LoungerFebruary 14, 2004 at 12:22 am #784272Hi Laura,
Interesting — I hadn’t encountered that since all the “frankenstyle” documents I have dealt with have gotten that way from being edited in previous versions of Word, so the style linking is gone.
I would think your documents would be fine as long as the triggers for creating the problem styles don’t occur — text formatted with the char style being edited in a previous Word version, or the issue with autotext in tables or used with the clipboard (which I can’t reproduce, no matter how hard I try). I did find that deleting the char style from the organizer will break the link, although I get an error message that it can’t be deleted, but when I check the task pane the linking is gone, and returning to the organizer the char style is no longer listed. So if it really bugs you to have them there, it looks like deleting the the char styles would do the trick.
I haven’t worked with VBA code on this issue, but check out Mesaka’s post in a similar thread, although you have probably already read it.
Christie
-
-
WSLauraT
AskWoody LoungerFebruary 6, 2004 at 11:39 pm #780226Hi Christie,
I wanted to ask — you mentioned using the organizer to copy in the correct style — this is what I’ve been doing programmatically (and sometimes manually). One thing I noticed though is that this does NOT change the style type back to PARAGRAPH, it remains a PARAGRAPH AND CHARACTER style. (Same with Andrew’s code to trip the aliases) Do you think this is anything to be concerned about?
The documents are behaving, but that “paragraph AND character” style type is REALLY bugging me — now that I know it exists…
Thanks
Laura
-
-
WSChristie
AskWoody Lounger -
WSGary Frieder
AskWoody LoungerApril 15, 2004 at 4:03 pm #813098(Edited by Gary Frieder on 15-Apr-04 12:03. )
Andrew,
Thought I should post this updated version in this thread, rather than the other one I started here.
This updated version will take care of the sample document which you sent, in which the ‘Char’ style names contain variants such as ‘Char 1’ or ‘Char Char’.
Someone else sent me a sample document with a much worse case of the ‘CharChars’, this revealed some other issues that a macro needs to deal with:Not all of the linked ‘CharChar’ styles created by Word are character styles; some of them can be paragraph styles. For these, the simplest approach is to just delete them. However, if they are built-in styles (such as Heading1), they cannot be deleted; in this case they need to be renamed – here is where your code to delete aliases comes in handy! (I’ve adapted it and converted it into a function.)
So this now appears to get rid of all the CharChar styles; a few caveats:
– The code searches for and gets rid of styles that have ” Char” in the style name, so it would be best to use a style naming convention that avoids the use of those letters.
– Any font formatting which was applied via the linked character style, will be lost.
– Any alias associated with a built-in style will be lost – if that built-in style had a ‘Char Char’ variant in the document
– If the document contains a very large number of styles, you may get a warning that Word is out of memory and the changes cannot be undone – just click on ‘Yes’ and allow it to continue (the test document I tried it on, had 240 styles).I’d be very interested if anyone else gets a chance to test this macro out – if any additional issues need to be accounted for, let us know.
Gary
Public Sub RemoveAllCharCharStyles2() 'Gary Frieder 2004 Dim objDocStyles As Styles Dim objTempStyle As Style Dim StylesCt As Long Dim strStyleName As String Dim c As Long Dim p As Long Set objDocStyles = ActiveDocument.Styles StylesCt = objDocStyles.Count 'First pass - get rid of linked character styles: For c = StylesCt To 1 Step -1 If objDocStyles©.Type = wdStyleTypeCharacter Then strStyleName = objDocStyles©.NameLocal If InStr(1, strStyleName, " Char") 0 Then Set objTempStyle = objDocStyles.Add(Name:="zTempStyle") objDocStyles(strStyleName).LinkStyle = objTempStyle objTempStyle.Delete Set objTempStyle = Nothing End If End If Next 'n 'Second pass - delete remnant linked paragraph styles with "Char" in name - 'However, built-in styles can't be deleted, these must be renamed: 'Number of styles in document has changed: StylesCt = objDocStyles.Count For p = StylesCt To 1 Step -1 If objDocStyles(p).Type = wdStyleTypeParagraph Then strStyleName = objDocStyles(p).NameLocal If InStr(1, strStyleName, " Char") 0 Then If objDocStyles(p).BuiltIn = False Then objDocStyles(p).Delete Else 'it's a built-in style, need to rename it instead: 'how to rename it? - use code to get rid of aliases: objDocStyles(p).NameLocal = strGetStyleNameMinusAliases(strStyleName) End If End If End If Next 'n Set objDocStyles = Nothing End Sub Public Function strGetStyleNameMinusAliases(ByVal StyleName As String) As String 'Adapted from code by Andrew Lockton: Dim iPos As Long iPos = InStr(1, StyleName, ",") If iPos 0 Then StyleName = Left$(StyleName, iPos - 1) End If strGetStyleNameMinusAliases = StyleName End Function
Credits/Reference:
The kernel for the above code was adapted from a macro posted by Cindy Meister here. Her original code was this:Sub DeleteHeading2Char() Dim styl As Word.Style, doc As Word.Document Set doc = ActiveDocument Set styl = doc.Styles.Add(Name:="Style1") On Error Resume Next doc.Styles("Heading 2 Char").LinkStyle = styl styl.Delete End Sub
The code for stripping aliases from style names is adapted from code posted by Andrew Lockton earlier in this thread.
A very good discussion of the hybrid linked character styles problem can be found in this white paper by Microsystems.
-
WSajulyguy
AskWoody LoungerApril 18, 2004 at 10:34 pm #816651Hi Gary,
This a great macro and I intend to try it out on documents created outside our authoring environment. This white paper from Microsystems is also an excellent reference. I am surprised that no one has mentioned (even Microsystems’ white paper) that “keep track of formatting” is the culprit for this problem. Is this not the case?
-
WSGary Frieder
AskWoody LoungerApril 19, 2004 at 6:36 am #816724Kyle,
Glad if this macro proves helpful.
There doesn’t seem to be too much information available about either linked character styles or ‘keep track of formatting’ (couldn’t find info on either in Word Help), but my understanding is that these are different things:
Linked character styles appear to be a feature intentionally introduced by Microsoft – the fact that there is a corresponding new VBA property (.LinkStyle) indicates that this was an intentional, planned addition to the Word object model – rather than an unintended side effect of ‘keep track of formatting’.
‘Keep track of formatting’ allows you, while using the Styles and Formatting task pane, to right-click on a given style and see how many times it is used in the document, and also select all instances of that style (it may have other uses I’m not familiar with….would be glad to hear of other uses). But that functionality doesn’t seem to be connected to the phenomenon of linked character styles. Also, you can create linked character styles, whether or not you have ‘keep track of formatting’ turned on.
Gary
-
WSGary Frieder
AskWoody LoungerApril 19, 2004 at 6:36 am #816725Kyle,
Glad if this macro proves helpful.
There doesn’t seem to be too much information available about either linked character styles or ‘keep track of formatting’ (couldn’t find info on either in Word Help), but my understanding is that these are different things:
Linked character styles appear to be a feature intentionally introduced by Microsoft – the fact that there is a corresponding new VBA property (.LinkStyle) indicates that this was an intentional, planned addition to the Word object model – rather than an unintended side effect of ‘keep track of formatting’.
‘Keep track of formatting’ allows you, while using the Styles and Formatting task pane, to right-click on a given style and see how many times it is used in the document, and also select all instances of that style (it may have other uses I’m not familiar with….would be glad to hear of other uses). But that functionality doesn’t seem to be connected to the phenomenon of linked character styles. Also, you can create linked character styles, whether or not you have ‘keep track of formatting’ turned on.
Gary
-
WSjscher2000
AskWoody LoungerApril 19, 2004 at 8:47 pm #817026> I am surprised that no one has mentioned (even Microsystems’ white paper) that “keep track of formatting” is
> the culprit for this problem. Is this not the case?Apparently there is something else going on. I made the same assumption, and was corrected, and verified that it’s something else, in this thread: Evil Word Styles (Word XP VBA) (long).
-
WSjscher2000
AskWoody LoungerApril 19, 2004 at 8:47 pm #817027> I am surprised that no one has mentioned (even Microsystems’ white paper) that “keep track of formatting” is
> the culprit for this problem. Is this not the case?Apparently there is something else going on. I made the same assumption, and was corrected, and verified that it’s something else, in this thread: Evil Word Styles (Word XP VBA) (long).
-
-
WSajulyguy
AskWoody LoungerApril 18, 2004 at 10:34 pm #816652Hi Gary,
This a great macro and I intend to try it out on documents created outside our authoring environment. This white paper from Microsystems is also an excellent reference. I am surprised that no one has mentioned (even Microsystems’ white paper) that “keep track of formatting” is the culprit for this problem. Is this not the case?
-
-
WSGary Frieder
AskWoody LoungerApril 15, 2004 at 4:03 pm #813099(Edited by Gary Frieder on 15-Apr-04 12:03. )
Andrew,
Thought I should post this updated version in this thread, rather than the other one I started here.
This updated version will take care of the sample document which you sent, in which the ‘Char’ style names contain variants such as ‘Char 1’ or ‘Char Char’.
Someone else sent me a sample document with a much worse case of the ‘CharChars’, this revealed some other issues that a macro needs to deal with:Not all of the linked ‘CharChar’ styles created by Word are character styles; some of them can be paragraph styles. For these, the simplest approach is to just delete them. However, if they are built-in styles (such as Heading1), they cannot be deleted; in this case they need to be renamed – here is where your code to delete aliases comes in handy! (I’ve adapted it and converted it into a function.)
So this now appears to get rid of all the CharChar styles; a few caveats:
– The code searches for and gets rid of styles that have ” Char” in the style name, so it would be best to use a style naming convention that avoids the use of those letters.
– Any font formatting which was applied via the linked character style, will be lost.
– Any alias associated with a built-in style will be lost – if that built-in style had a ‘Char Char’ variant in the document
– If the document contains a very large number of styles, you may get a warning that Word is out of memory and the changes cannot be undone – just click on ‘Yes’ and allow it to continue (the test document I tried it on, had 240 styles).I’d be very interested if anyone else gets a chance to test this macro out – if any additional issues need to be accounted for, let us know.
Gary
Public Sub RemoveAllCharCharStyles2() 'Gary Frieder 2004 Dim objDocStyles As Styles Dim objTempStyle As Style Dim StylesCt As Long Dim strStyleName As String Dim c As Long Dim p As Long Set objDocStyles = ActiveDocument.Styles StylesCt = objDocStyles.Count 'First pass - get rid of linked character styles: For c = StylesCt To 1 Step -1 If objDocStyles©.Type = wdStyleTypeCharacter Then strStyleName = objDocStyles©.NameLocal If InStr(1, strStyleName, " Char") 0 Then Set objTempStyle = objDocStyles.Add(Name:="zTempStyle") objDocStyles(strStyleName).LinkStyle = objTempStyle objTempStyle.Delete Set objTempStyle = Nothing End If End If Next 'n 'Second pass - delete remnant linked paragraph styles with "Char" in name - 'However, built-in styles can't be deleted, these must be renamed: 'Number of styles in document has changed: StylesCt = objDocStyles.Count For p = StylesCt To 1 Step -1 If objDocStyles(p).Type = wdStyleTypeParagraph Then strStyleName = objDocStyles(p).NameLocal If InStr(1, strStyleName, " Char") 0 Then If objDocStyles(p).BuiltIn = False Then objDocStyles(p).Delete Else 'it's a built-in style, need to rename it instead: 'how to rename it? - use code to get rid of aliases: objDocStyles(p).NameLocal = strGetStyleNameMinusAliases(strStyleName) End If End If End If Next 'n Set objDocStyles = Nothing End Sub Public Function strGetStyleNameMinusAliases(ByVal StyleName As String) As String 'Adapted from code by Andrew Lockton: Dim iPos As Long iPos = InStr(1, StyleName, ",") If iPos 0 Then StyleName = Left$(StyleName, iPos - 1) End If strGetStyleNameMinusAliases = StyleName End Function
Credits/Reference:
The kernel for the above code was adapted from a macro posted by Cindy Meister here. Her original code was this:Sub DeleteHeading2Char() Dim styl As Word.Style, doc As Word.Document Set doc = ActiveDocument Set styl = doc.Styles.Add(Name:="Style1") On Error Resume Next doc.Styles("Heading 2 Char").LinkStyle = styl styl.Delete End Sub
The code for stripping aliases from style names is adapted from code posted by Andrew Lockton earlier in this thread.
A very good discussion of the hybrid linked character styles problem can be found in this white paper by Microsystems.
-
-
Andrew Lockton
AskWoody_MVPMarch 30, 2004 at 12:29 pm #778064I will add a few of my random thoughts …
I prefer to call them Dancing Styles (as in Slide Slide Char Char Char). They can grow larger than a style name allows (256 characters I think) which will then give a funny result that a second hidden style with the same name gets created but can’t be seen in anything other than a RTF file. If you delete a style with a hidden one behind it, the hidden one can then be seen, which makes it appear that the delete didn’t happen. If you delete the second one then it really gets deleted.
I can also demonstrate a couple of ways to create a dancing style (frankenstyle) without leaving Word 2002.
Select a part of a paragraph within a table and apply another paragraph style (eg Heading 1)
Add the table as a new autotext entry
Insert the autotext entry back into the file
That gives me a “Heading 1, Heading 1 Char” style
In a previous thread Terri Gerlich (tgerlich – post 259228) also mentions using the clipboard task pane rather than an autotext entry will do the same thing.I can remove most of the problems once started by running a macro which removes all style aliases. This macro, whilst not originally created to resolve the dancing styles, is quite effective in reducing the problem before it goes too far. The macro looks like this
Sub RemoveAllStyleAliases() Dim aStyle As Variant, iPos As Integer For Each aStyle In ActiveDocument.Styles iPos = InStr(1, aStyle, ",") If iPos 0 Then aStyle = Left(aStyle, iPos - 1) On Error Resume Next ActiveDocument.Styles(aStyle).NameLocal = aStyle On Error GoTo 0 End If Next aStyle End Sub
This macro should not be used if you are at all attached to other style aliases. A macro has now been posted by Gary Frieder – post 357927 which is more specific to resolving the char styles created as links to an existing paragraph style.
Knowing what causes the problem, avoiding these runaway styles in the first place appears to be easy enough – never apply paragraph styles to anything less than a full paragraph (easier said than done). You should have less problems if you avoid applying local formatting where possible and primarily relying on paragraph styles for formatting.
Viewing 3 reply threads -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Office gets current release
by
Susan Bradley
1 hour, 30 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
18 hours, 2 minutes ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
2 hours, 33 minutes ago -
Stop the OneDrive defaults
by
CWBillow
18 hours, 51 minutes ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
1 day, 4 hours ago -
X Suspends Encrypted DMs
by
Alex5723
1 day, 6 hours ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
1 day, 7 hours ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
1 day, 7 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
1 day, 8 hours ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
20 hours, 40 minutes ago -
Enabling Secureboot
by
ITguy
1 day, 3 hours ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day, 16 hours ago -
No more rounded corners??
by
CWBillow
1 day, 12 hours ago -
Android 15 and IPV6
by
Win7and10
1 day, 1 hour ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
2 days, 4 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
2 days, 7 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
2 days, 2 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
2 days, 14 hours ago -
May preview updates
by
Susan Bradley
2 days, 2 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
1 day, 17 hours ago -
Just got this pop-up page while browsing
by
Alex5723
2 days, 6 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
2 days, 4 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
1 day, 6 hours ago -
At last – installation of 24H2
by
Botswana12
3 days, 6 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
4 hours, 2 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
3 days, 18 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 16 hours ago -
Limited account permission error related to Windows Update
by
gtd12345
4 days, 7 hours ago -
Another test post
by
gtd12345
4 days, 8 hours ago -
Connect to someone else computer
by
wadeer
9 hours, 22 minutes ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.