Sub test()
ResetSearch
'cursief-codes vervangen door opmaak
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Italic = True
With Selection.Find
.Text = "\<i\>(*)\</i\>"
.Replacement.Text = "\1"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
ResetSearch
End Sub
This macro works quite well, exept when there are {REF ...} fields
between the italics-codes.
I'm looking for a solution for this.
1. Run the macro above.
2. Check for left <i> and/or </i>
3. Run the alternative (slower?) macro to make the reference fields
italics?
What I can think of are two solutions:
1. Search for <i>. On found:
2. Turn expansion mode on
3. Search for </i>
4. Make the selection italics
5. Etc.
6. Remove the code pairs.
Or:
1. Search for <i>. On found:
2. Define a range until the next </i>, how?
Hans List
Dim IEApp
Dim MyText
Set IEApp = CreateObject("InternetExplorer.Application")
IEApp.Visible = False
IEApp.Silent = True
IEApp.Navigate "MyFilePath"
Do Until Not IEApp.Busy And IEApp.ReadyState = READYSTATE_COMPLETE
DoEvents
Loop
MyText = IEApp.Document.All.tags("body").Item(0).innerText
IEApp.Quit
Set IEApp = Nothing