Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 01-21-2021, 05:01 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

Paul and Greg,

thank you very much for this. Both Greg's and Paul's solutions worked for me.
I used this for flattening lists, they needed to be converted to plain text paragraphs (including the list number). This is probably going to end the issues we had with it concerning the italics.

A trimmed down code example is now:
Code:
Public Sub flattenLists()
    Dim strListNr As String
    Dim wPara As Word.Paragraph
    Dim wList as Word.List

    For Each wList In Word.ActiveDocument.Lists
        With wList
            For Each wPara In .ListParagraphs
                wPara.range.Select
                With wPara
                    strListNr = .range.ListFormat.ListString

                    .range.ListFormat.RemoveNumbers NumberType:=wdNumberParagraph
                    wPara.Range.ParagraphFormat.Reset
                    .range.InsertBefore strListNr & Chr(32)
                End With
            Next
        End With
    Next
End Sub
I am still curious what is happening when I use the old code. Googling around I found more mentions of this problem, some from ten years back. Is my conclusion right that setting the paragraph style is in the danger zone when it comes to macro's?

Thanks again, Ruud
Reply With Quote
 

Thread Tools
Display Modes


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 03:15 PM.


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