Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 03-06-2020, 08:32 PM
macropod's Avatar
macropod macropod is offline Help using VBA to find a hidden text string Windows 7 64bit Help using VBA to find a hidden text string Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,373
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

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]
Reply With Quote
 

Tags
hidden text, vba code, vba find and replace



Similar Threads
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
Help using VBA to find a hidden text string Way to search for a string in text file, pull out everything until another string? omahadivision Excel Programming 12 11-23-2013 12:10 PM
Help using VBA to find a hidden text string Find and replace a string of text errtu Word 1 01-31-2013 02:09 PM
Help using VBA to find a hidden text string Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

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