View Single Post
 
Old 01-15-2021, 08:55 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I am not seeing that "exact" behavior (... number of inline characters ...). When I first ran the code it worked as expected. What I did see is if the "Italic" direct formatting extends to and includes the paragraph mark then the result is like you show. You might try:

Code:
Public Sub flatten()
Dim wPara As Word.Paragraph
  For Each wPara In Word.ActiveDocument.Paragraphs
    wPara.Range.Characters.Last.Select
    On Error Resume Next
    With Selection
      .ClearCharacterDirectFormatting
      .ClearCharacterStyle
    End With
    wPara.Style = ActiveDocument.Styles(wdStyleNormal).NameLocal
  Next
 End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote