Hi,
I am trying to create a macro in Word 2007 which enables me to, select a paragraph and using ctrl+f select all the highlighted words in the paragraph.Usually I would highlight a paragraph, then press ctrl+f, click on the more options button, select ‘highlight’ via the format button, and then the click ‘find in current selection’ button.
I’ve made a picture which hopefully explains what I want much better.
I have spend ages trying to create a macro for this, but have had a no luck – although I am a complete novice.The best I’ve managed to do is the following VBA code; however this doesn’t highlight al highlighted parts in my current selection, it just uses goes through the whole document, and when I run the macro it just goes onto the next highlighted word.
Sub CurrentSelectionSelectHighlighted()
‘
‘ CurrentSelectionSelectHighlighted Macro
‘
‘
Selection.Find.ClearFormatting
Selection.Find.Highlight = True
With Selection.Find
.Text = “”
.Replacement.Text = “”
.Forward = True
.Wrap = wdFindAsk
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchDiacritics = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub
Could someone please help me. I would really appreciate it. I am a university student and I’ve got exams around the corner and this macro (if possible) would save me a lot of time.