Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-27-2020, 12:32 PM
alex100 alex100 is offline How to clear the 'OutlineLevel' property Windows 7 64bit How to clear the 'OutlineLevel' property Office 2016
Advanced Beginner
How to clear the 'OutlineLevel' property
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default How to clear the 'OutlineLevel' property

How can I clear the 'OutlineLevel' property from all the paragraphs inside a selection, please?

The code below doesn't work, I'm just listing it here to give you an idea of what I'm looking for.

Code:
With Selection.Find
    .OutlineLevel = wdOutlineLevel1
    .Wrap = wdFindStop
    With .Replacement
        .OutlineLevel = wdOutlineLevelBodyText
    End With
    .Execute FindText:="", ReplaceWith:="", Format:=True, Replace:=wdReplaceAll
End With
Ideally, the code should match not only the first level (wdOutlineLevel1, as in the code above), but all the property levels (up to 9).

The reason I'm looking for such a routine, is that from time to time it happens that I paste some text with paragraphs that show up as headings on the navigation panel, yet they do not have a 'heading' style attached to them. I checked, and they just have this 'OutlineLevel' property set. Once I remove it, the paragraphs no longer show under the navigation panel, which is what I'm looking for.



The code should only search in the current selection (which is usually the last pasted text), not in the whole document.

Alex
Reply With Quote
  #2  
Old 06-27-2020, 12:50 PM
eduzs eduzs is offline How to clear the 'OutlineLevel' property Windows 10 How to clear the 'OutlineLevel' property Office 2019
Expert
 
Join Date: May 2017
Posts: 260
eduzs is on a distinguished road
Default

If you want to clear any outline level from the entire selection, there's no need to use FIND, you maybe just use something like this:

Code:
Selection.Range.ParagraphFormat.OutlineLevel=wdOutlineLevelBodyText

Last edited by eduzs; 06-28-2020 at 02:37 AM.
Reply With Quote
  #3  
Old 06-27-2020, 11:47 PM
alex100 alex100 is offline How to clear the 'OutlineLevel' property Windows 7 64bit How to clear the 'OutlineLevel' property Office 2016
Advanced Beginner
How to clear the 'OutlineLevel' property
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default

Wonderful, thank you!

Alex
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clear rows with vba DIMI Excel Programming 3 01-30-2020 09:22 AM
Clear browser history Venom286 Outlook 0 04-08-2019 11:17 PM
Clear old RSS Feeds eltonlaw Outlook 0 08-16-2012 07:32 PM
How to clear the 'OutlineLevel' property Clear document Jaymond Flurrie Word VBA 5 07-17-2011 05:07 PM
Holidays--clear all? markg2 Outlook 0 11-01-2009 05:57 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:23 PM.


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