Can you remove a style from text without losing the formatting?

J

JoAnn

Hi,

I'm not sure how to word this correctly but I'd like to
find a way to remove styles and have all text formatted in
that style retain its formatting as if it were manually
applied. Is that possible?

Thanks,
JoAnn
 
M

mbaird

You would have to get all of the attributes of the style so that you can
re-apply the formatting when the style is deleted.

Mark Baird
 
H

Helmut Weber

Hi JoAnn,
like this:
Sub Test544()
Dim sStl As String ' a style
Dim oFnt As Font ' a font
Set oFnt = ActiveDocument.Paragraphs(1).Range.Font
With ActiveDocument.Paragraphs(1).Range.Font
.Name = oFnt.Name
.Size = oFnt.Size
.Bold = oFnt.Bold
.Italic = oFnt.Italic
.Underline = oFnt.Underline
.Superscript = oFnt.Superscript
.Subscript = oFnt.Subscript
.UnderlineColor = oFnt.UnderlineColor
.StrikeThrough = oFnt.StrikeThrough
.DoubleStrikeThrough = oFnt.DoubleStrikeThrough
.Outline = oFnt.Outline
.Emboss = oFnt.Emboss
.Shadow = oFnt.Shadow
.Hidden = oFnt.Hidden
.SmallCaps = oFnt.SmallCaps
.AllCaps = oFnt.AllCaps
.Color = oFnt.Color
.Engrave = oFnt.Engrave
.Spacing = oFnt.Spacing
.Scaling = oFnt.Scaling
.Position = oFnt.Position
.Kerning = oFnt.Kerning
.Animation = oFnt.Animation
End With
sStl = ActiveDocument.Paragraphs(1).Style
ActiveDocument.Styles(sStl).Delete
End Sub
 
J

JoAnn

Thank you for your assistance - this is just what I needed!

Incase anyone is interested, I also discovered that I can
dump all styles from an entire document (and retain
formatting as if manually applied) by saving my document
as a PDF then using a PDF Converter to save it back to
Word. I used Scansoft's PDF Create and PDF Converter to
do this.

I can think of situations in which both approaches will be
helpful to me.

Many thanks to you both!
JoAnn
 

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