Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-14-2022, 11:44 AM
amberliufan123abc amberliufan123abc is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Novice
Deleting chapters which don't contain certain words?
 
Join Date: Jan 2022
Posts: 5
amberliufan123abc is on a distinguished road
Default Deleting chapters which don't contain certain words?

Hi all,

I'm working with a document which contains many chapters, and I would like to keep only the chapters which contain certain phrases (there's a fairly long list of them but an example would be 'transgender men'). Does anyone know how I could do this? Doing it manually would be quite an ordeal.



Thank you!
Reply With Quote
  #2  
Old 01-14-2022, 03:13 PM
Charles Kenyon Charles Kenyon is online now Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

How are your chapters divided?

Heading styles?
Section breaks?
Reply With Quote
  #3  
Old 01-15-2022, 03:33 AM
amberliufan123abc amberliufan123abc is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Novice
Deleting chapters which don't contain certain words?
 
Join Date: Jan 2022
Posts: 5
amberliufan123abc is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
How are your chapters divided?

Heading styles?
Section breaks?
I'm not entirely sure but I think heading styles.
Reply With Quote
  #4  
Old 01-15-2022, 07:08 AM
Charles Kenyon Charles Kenyon is online now Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Please attach a sample document (not a screenshot) with at least three chapters.

How to attach a screenshot or file in this forum.
Reply With Quote
  #5  
Old 01-17-2022, 02:37 AM
amberliufan123abc amberliufan123abc is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Novice
Deleting chapters which don't contain certain words?
 
Join Date: Jan 2022
Posts: 5
amberliufan123abc is on a distinguished road
Default

Quote:
Originally Posted by Charles Kenyon View Post
Please attach a sample document (not a screenshot) with at least three chapters.

How to attach a screenshot or file in this forum.
Sure. I've attached an example with one file that I want to keep and two that I don't. I want to keep the article which contains 'trans men'.
Attached Files
File Type: docx BBC new kids.docx (36.0 KB, 11 views)
Reply With Quote
  #6  
Old 01-17-2022, 12:18 PM
Charles Kenyon Charles Kenyon is online now Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Your document uses Heading 1 to delineate your sections. It also has a bunch of apparently unnecessary section breaks that are not relevant to our discussion.

However, it does not contain the phrase "transgender men."

As an example, I will simply search for "transgender" which it does have in two sections and not in the third.

I use the Navigation Pane and type "transgender" in the search box, keeping it on the Headings tab. Two show up as having that term, the third is not highlighted so does not contain the term.


I right-click on the heading that does not contain the term and choose Delete. That section (everything from that heading to the next Heading 1 paragraph) is deleted.

I recommend doing this in a copy and being careful of your search terms. For instance, if there had been a typo or the term "transgender man" had been used it would not be picked up in such a search. Neither would "trans men."
Reply With Quote
  #7  
Old 01-17-2022, 12:22 PM
Charles Kenyon Charles Kenyon is online now Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Sorry, I did not read enough.


Same process. Same warnings.


Is this going to be too tedious?
Reply With Quote
  #8  
Old 01-18-2022, 05:13 AM
amberliufan123abc amberliufan123abc is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Novice
Deleting chapters which don't contain certain words?
 
Join Date: Jan 2022
Posts: 5
amberliufan123abc is on a distinguished road
Default

Thank you so much for taking the time to have a look at it. Your method is certainly one that I've thought of, but it probably would take a lot of time I'm afraid. This is firstly because I have multiple search terms that I need to keep (transgender men, transgender man, trans men, trans man, female-to-male...), so I can't just delete the chapters which don't contain, for instance, 'trans men' because I might also be deleting chapters which contain other terms that I want. The only real solution I can think of currently would be to use the search bar to find all the relevant chapters and then manually copy-paste them all into a different document, but that would be extremely tedious because there are literally hundreds of those in the actual document!
Reply With Quote
  #9  
Old 01-18-2022, 05:41 AM
Charles Kenyon Charles Kenyon is online now Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2019
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,083
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Rather than copy into a different document, copy the document and delete from the copy. Perhaps prepare an index that has the terms you want and use that as a guide to the sections to be deleted.
Reply With Quote
  #10  
Old 01-18-2022, 08:02 AM
amberliufan123abc amberliufan123abc is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Novice
Deleting chapters which don't contain certain words?
 
Join Date: Jan 2022
Posts: 5
amberliufan123abc is on a distinguished road
Default

I'll have a go with that - thank you for your help!
Reply With Quote
  #11  
Old 01-20-2022, 07:13 PM
Guessed's Avatar
Guessed Guessed is offline Deleting chapters which don't contain certain words? Windows 10 Deleting chapters which don't contain certain words? Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

I would try to work out a workflow to do this efficiently. The best I can think of is:
1. Put each article into a Rich Text Content Control and set the tag property of each to a static phrase such as "Delete me"
2. Run a macro which searches for each of the key terms and wherever there is a hit, change the tag property of the CC it sits in to "Keep me"
3. At the end of the macro running, delete all the CC ranges that are still tagged as "Delete me"
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Tags
chapters

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapters in Headers RRB Word 4 04-26-2021 03:08 PM
Deleting chapters which don't contain certain words? deleting "s" at end of words cinci-hal Word 1 08-27-2017 02:14 PM
Deleting chapters which don't contain certain words? Need VBA to renumber chapters bobbyrjw Word VBA 3 01-03-2017 12:15 AM
How to number chapters and sub-chapters in a few clicks? Icelandic_Boy Word 1 05-24-2016 11:33 AM
Deleting chapters which don't contain certain words? Deleting a script in an equation without deleting the whole term allankey Word 1 02-15-2014 07:09 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:01 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