![]() |
#8
|
|||
|
|||
![]()
Hello Macropod,
I Still can't select after the find header :-( And I don't see why. Can you help me with debug the code? Thanks! Sub Select_text() Selection.WholeStory Selection.Collapse wdCollapseStart Selection.Find.ClearFormatting Selection.Find.Style = ActiveDocument.Styles("Kop 2") 'This will only search in header type "Kop 2" With Selection.Find .Text = "1.2 Doelstelling" 'Search for the first header text .Forward = True .Wrap = wdFindContinue .Format = True .MatchCase = False .MatchWholeWord = True End With Selection.Find.Execute Selection.Collapse wdCollapseStart Dim R_start As Range Set R_start = Selection.Range 'Start Selection form first header text Selection.Find.Text = "1.3 Scenario's" 'Search for the second header text If Selection.Find.Execute Then Selection.Collapse wdCollapseStart Else Selection.WholeStory Selection.Collapse wdCollapseEnd End If Dim R_end As Range Set R_end = ActiveDocument.Range(R_start.End, Selection.Start) R_end.Select End Sub |
Tags |
chapters, selecting text |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
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 |
![]() |
newbieX | Word VBA | 3 | 03-28-2014 04:21 PM |