Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 10-10-2017, 10:18 PM
macropod's Avatar
macropod macropod is offline How to Select text between Chapters Windows 7 64bit How to Select text between Chapters Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

If the heading for Chapters 1.2 & 1.3 use Heading Styles, you can use Find to locate the heading, then .GoTo What:=wdGoToBookmark, Name:="\HeadingLevel" to get the corresponging content. For example:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "Heading Text"
    .Style = "Heading 1"
    .Format = True
    .Forward = True
    .MatchCase = True
    .Wrap = wdFindStop
    .MatchWildcards = False
    .Execute
  End With
  If .Find.Found = True Then
    Set Rng = .Duplicate.GoTo(What:=wdGoToBookmark, Name:="\HeadingLevel")
    MsgBox Rng.Text
  End If
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
 

Tags
chapters, selecting text



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Select text between Chapters After putting a text box behind text I can't select it anymore Mike84bs Word 2 07-25-2016 07:36 AM
How to number chapters and sub-chapters in a few clicks? Icelandic_Boy Word 1 05-24-2016 11:33 AM
VBA Search Table for Text/Select Text/Insert Hyperlink sldrellich Word VBA 3 03-24-2015 01:09 PM
Microsoft Word macro to find text, select all text between brackets, and delete helal1990 Word VBA 4 02-05-2015 03:52 PM
How to Select text between Chapters Select section of text and change text newbieX Word VBA 3 03-28-2014 04:21 PM

Other Forums: Access Forums

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