Hi!
I have to find "Ref.2", etc. i.e., default text "Ref." with superscript numbers.
I can find "Ref." and superscript numbers separately. But, I don't know, how to find them combined.
Anybody please help!
Regards
Alex
Hi!
I have to find "Ref.2", etc. i.e., default text "Ref." with superscript numbers.
I can find "Ref." and superscript numbers separately. But, I don't know, how to find them combined.
Anybody please help!
Regards
Alex
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "Ref." While .Execute Do While oRng.Characters.Last.Next Like "[0-9]" _ And oRng.Characters.Last.Next.Font.Superscript oRng.MoveEnd wdCharacter, 1 Loop oRng.Select 'Do something with the found range. oRng.Collapse wdCollapseEnd Wend End With lbl_Exit: Exit Sub End Sub
Thank you for come forward to help!
This code finds the "Ref."+number with/without superscript. But, I need to find only superscript numbers with text "Ref." Can you please look into this...Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng As Word.range Set oRng = ActiveDocument.range With oRng.Find .Text = "Ref. " While .Execute Do While oRng.Characters.Last.Next Like "[0-9]" _ And oRng.Characters.Last.Next.Font.Superscript oRng.MoveEnd wdCharacter, 1 Loop oRng.Select 'Do something with the found range. oRng.HighlightColorIndex = wdTurquoise oRng.Font.Color = wdColorPink oRng.Comments.Add oRng, "CE: Reference callouts should not be in superscript." oRng.Collapse wdCollapseEnd Wend End With lbl_Exit: Exit Sub End Sub
Regards
Alex
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .Text = "Ref." While .Execute Do While oRng.Characters.Last.Next Like "[0-9]" _ And oRng.Characters.Last.Next.Font.Superscript oRng.MoveEnd wdCharacter, 1 Loop If Len(oRng.Text) > 4 Then oRng.Select 'Do something with the found range. End If oRng.Collapse wdCollapseEnd Wend End With lbl_Exit: Exit Sub End Sub
Thanks a lot!!!
It works fine...!!!
Regards
Alex