He davers,
Sorry for not posting before - been a bit busy.
In Word, the
Find function can be set to use '
wildcards' - this should help you with your task. Below is some script that you can paste into your VBA window (Alt+F11) and then run from your macro menu.
Code:
Sub Find_and_Italicise()
'
' Macro recorded by Bird_FAT
' This macro uses the wildcard '*' to look for text
' between to underscores, then italicises the text.
' The While/Wend statement at the end causes it to
' loop until it reaches the end of the document.
'
Selection.Find.ClearFormatting
With Selection.Find
.Text = "_*_"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
While Selection.Find.Execute
Selection.Font.Italic = wdToggle
Wend
End Sub
To use the
wildcard feature, when you use
Find/Find and Replace, select '
More' (if not already visible) and tick the '
Use wildcards' box - if you open
Help and type '
wildcards' and choose the second option in the list it has some really great information there as a reference.