View Single Post
  #7   Report Post  
SteveBabb SteveBabb is offline
Junior Member
 
Posts: 0
Default

I have a problem with the unlink based on style. The style uses frames, and when unlinked from the base style, the frame disappears.
I am working on this in order to use the master/sub document functionality. I want to change the headings of the document to be in inserted so that the master template does not overwrite their heading styles, which are different than the document into which the subdocument is being inserted.
Using some internet resources I have a macro to create a new style based on the heading and replaces it in the document prior to insertion. Unfortuneatley the headings use frames and when I set the base style property to none, the frame drops out. I need to set the base style to none, so that the destination heading doesn't flow into the new style.
code:
Sub changeHeadingtoStyle()
'sParStyle = ActiveDocument.Paragraphs(J).Style

Chead = Selection.Paragraphs.Style.NameLocal
NewName = "Merged2" & Chead
ActiveDocument.Styles.Add Name:=NewName, Type:=wdStyleTypeParagraph

Selection.Find.ClearFormatting
Selection.Find.Style = ActiveDocument.Styles(Chead)
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Style = ActiveDocument.Styles(NewName)
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
'ActiveDocument.Styles(NewName).BaseStyle = ""

End Sub
the only solution I see is to copy the newly created style to a macro generated document, change the base style property to none there, rename the style, bring it back to the original document and do a search and replace for the heading. Does anyone have a simpler suggestions. Again main point is to use master/subdocument functionality so that a document inserted doesn't have its built in headings assume the formatting of the master document.
thanks
Steve

"Graham Mayor" wrote:

This sounds like an unnecessary rigmarole for a basic style editing
function. If you create a new style based on another style, then unlink the
'based on' style by changing it to based on 'no style', the original style
parameters are retained along with with your edits, but not linked to the
original style.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Jugglertwo wrote:
Your suggestion worked great. I wanted to use it for a user defined
style so your directions were just right.
I'm pretty sure that I wouldn't have been able to figure this one out
anytime in the near future by myself.
Thanks again and I owe you one!
You are the BESTEST
Jugglertwo

"periodic" wrote:

If its not a built in style you can do as follow
Tools | Templates and Add-ins | Organizer

Copy the style you want to duplicate to normal.dot (or preferably
some dummy document) rename it, and copy it back. If you used
normal.dot as you temporary storage. Delete the style from
normal.dot.

If its a built in style the same method wont work since you will not
really change its name, just give it a new alias.

I do not really know how to do this with a built-in style other than
using some VBA

"Jugglertwo" wrote:

I haven't been able to figure this out.
How do I duplicate a Word style?
I was asked this recently by a co-worker and I haven't been able to
figure it out but it seems like it should be possible.
I'm familiar with creating, applying and modifying styles. I also
use the Organizer.
1) My co-worker wants to create a style and copy the style so they
can modify a second style slightly. They do not want to have to go
through all the steps to create the second style and make the one,
small change when the orginal style has all of the starting
formatting. 2) Also, I do NOT want the second style based on the
first style as I do not want the second style modified when I make
changes to the first style.

Hope this isn't overly confusing.
Thanks for any assistance in advance!
Jugglertwo



[/quote]