Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2021, 08:55 AM
gmaxey gmaxey is offline setting paragraph style removes inlines incidentally. Why? Windows 10 setting paragraph style removes inlines incidentally. Why? Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
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
  #2  
Old 01-19-2021, 03:06 AM
rgros rgros is offline setting paragraph style removes inlines incidentally. Why? Windows 10 setting paragraph style removes inlines incidentally. Why? Office 2019
Novice
setting paragraph style removes inlines incidentally. Why?
 
Join Date: Jan 2021
Posts: 8
rgros is on a distinguished road
Default

Hi Greg,
I have had a look at my test documents and indeed it seems I have taken the wrong conclusion about the string lenghts and more important, that the real problem is the line endings being italic.

I have tested the code you posted and actually that solved my problem completely with the test document.

Unfortunately, the solution does not work with the real life documents. Obviously, there is more going on; the disappearing italics are inside list items.
In order to provide a test document that shows this, I should post it in this forum. Is that posssible?

Ruud
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA - (Re-) Setting a Table Style mikejvir PowerPoint 2 12-04-2019 10:15 AM
Why does paragraph inherit style of the following paragraph? WADEVCAMP Word VBA 2 04-08-2019 02:13 PM
Setting part of a paragraph bold Fred256 Word VBA 4 10-07-2016 02:54 PM
setting paragraph style removes inlines incidentally. Why? Style seems to inherit bold setting from previous style Jennifer Murphy Word 3 02-16-2012 04:18 PM
Character style stripped while applying paragraph style sams_gates Word 0 08-29-2009 02:03 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:11 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft