Tabstops removed after assigning style

M

Mamue

Hi,

when i assign a special style to any text in my word document, the
tabstops are removed. i just want to change the corresponding
character style, not my tabstops.

thanks, matthias
 
R

reitanospa1

Styles contain both character and paragraph formats, so your tabs will
be replaced whenever you apply a style. You can add the tabs to the
style or create a new style that contains the same formatting plus the
tabs.

Sorry.
 
K

klaus.linke

Hi,

when i assign a specialstyleto any text in my word document, the
tabstops are removed. i just want to change the corresponding
characterstyle, not my tabstops.

thanks, matthias



Hi Matthias,

With a little VBA, you can write a macro that applies some style to a
paragraph without changing the tab stops:


Call ApplyStyleOldTabs("Heading 1")


Sub ApplyStyleOldTabs(StyleName As String)
Dim myPF As ParagraphFormat
Dim myTab As TabStop
Set myPF = Selection.ParagraphFormat.Duplicate
' Apply style
Selection.Style = ActiveDocument.Styles(StyleName)
' Re-set TabStops
Selection.ParagraphFormat.TabStops.ClearAll
For Each myTab In myPF.TabStops
Selection.ParagraphFormat.TabStops.Add _
myTab.Position, _
myTab.Alignment, _
myTab.Leader
Next myTab
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top