I can't figure out how to use VBA to find a hidden text string.
The following code is a macro I coded (unsuccessfully) trying to use tips in several postings I found on the web. I included a couple of comment lines I put into the macro so that I'd be able to refer to the examples I was trying (unsuccessfully) to emulate.
Code:
Sub subBkMarkFindAndBkMarkNextTblOfExhibitsPara()
'https://benread.net/tools/macros-word-general.html
'https://www.office-forums.com/threads/finding-hidden-text-in-word-vba.2349850/
Application.ScreenUpdating = False
Dim bShow As Boolean
bShow = ActiveWindow.View.ShowHiddenText
ActiveWindow.View.ShowHiddenText = True
With Selection.Find
.ClearFormatting
.Text = "[FULLNAME: PDF] "
.MatchWildcards = False
.Forward = False
.Style = ActiveDocument.Styles("Heading 1")
.Execute
.ClearFormatting
.Forward = True
End With
With Selection.Find
.ClearFormatting
.MatchWildcards = False
.Text = "[FULLNAME: PDF] "
.Forward = True
.Wrap = wdFindStop
.Format = False
.Font.Hidden = True
If .Execute Then
'I guess "If .Execute = True", your code continues processing from here.
Selection.HomeKey Unit:=wdLine, Extend:=wdMove
With ActiveDocument.Bookmarks
.Add Range:=Selection.Range, Name:="LastEntryThusFarMadeInTblOfExhibits"
.DefaultSorting = wdSortByName
.ShowHidden = False
End With 'With ActiveDocument.Bookmarks
Else ' If .Execute Then
MsgBox "Message from Macro: NMc:subBkMarkFindAndBkMarkNextTblOfExhibitsPara()" & _
"[FULLNAME: PDF] wasn't found."
End If 'If .Execute Then
End With 'With Selection.Find
ActiveWindow.View.ShowHiddenText = bShow
Application.ScreenUpdating = True
Call subBkMarkNextEntryInTblOfExhibits
End Sub 'subBkMarkFindAndBkMarkNextTblOfExhibitsPara