![]() |
|
#4
|
||||
|
||||
|
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
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| The characters of my received emails are little squares! HELP! | chocolatecookies | Outlook | 0 | 12-17-2008 04:17 PM |
| Templates: automatic text generation from Rich Text content control | Chickenmunga | Word | 0 | 10-01-2008 11:16 AM |
| special/escape/insertion characters in word | manojbmsce | Word | 0 | 09-25-2008 06:40 AM |
Making sure the correct number of characters are entered.
|
leroytrolley | Excel | 1 | 07-25-2008 06:38 AM |
| escape characters | LadyReader | Word VBA | 0 | 09-06-2006 12:09 PM |