![]() |
#7
|
||||
|
||||
![]()
Try:
Code:
Sub Demo() Application.ScreenUpdating = False Dim Rng As Range With ActiveDocument Set Rng = Selection.Characters.Last Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="LastEntryThusFarMadeInTblOfExhibits") Set Rng = Rng.GoTo(What:=wdGoToBookmark, Name:="\HeadingLevel") Rng.Collapse wdCollapseEnd Rng.End = .Range.End With Rng With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "[!^13]@[FULLNAME: PDF] " .Style = "Heading 1" .Font.Hidden = True .Replacement.Text = "" .Forward = True .Format = False .Wrap = wdFindStop .MatchWildcards = True .Execute End With If .Find.Found = True Then .Collapse wdCollapseStart .Bookmarks.Add Name:="LastEntryThusFarMadeInTblOfExhibits", Range:=.Duplicate End If End With End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
hidden text, vba code, vba find and replace |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to find all string within string. | PRA007 | Word VBA | 18 | 02-12-2016 08:11 PM |
VBA to Find and Format Text string defined using Inputbox within selection | sistemalan | Word VBA | 7 | 10-03-2014 07:28 AM |
![]() |
omahadivision | Excel Programming | 12 | 11-23-2013 12:10 PM |
![]() |
errtu | Word | 1 | 01-31-2013 02:09 PM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |