Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Word Newsgroups
Word VBA
Searching for StyleRef Fields (STYLEREF 1 \n) in Headers
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Graham Mayor, post: 5875036"] A simpler approach would be to test the field types and then their content eg Sub Search_StyleRef_1_N_Header() Dim rng As Range Dim AskText As String Dim AskReplacementText As String Dim sec As Section Dim hdr As HeaderFooter Dim fld As Field For Each sec In ActiveDocument.Sections For Each hdr In sec.Headers For Each fld In hdr.Range.Fields If fld.Type = wdFieldStyleRef Then If InStr(1, fld.Code, "1 \n") Then MsgBox "StyleRef field (STYLEREF 1 \n) has been found" Exit Sub End If End If Next fld Next hdr Next sec MsgBox "No StyleRef Fields (STYLEREF 1 \n) found" End Sub -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP <>>< ><<> ><<> <>>< ><<> <>>< <>><<> [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Word Newsgroups
Word VBA
Searching for StyleRef Fields (STYLEREF 1 \n) in Headers
Top