View Single Post
 
Old 01-09-2016, 06:27 AM
Thefirstfish` Thefirstfish` is offline Windows 10 Office 2016
Novice
 
Join Date: Dec 2015
Posts: 11
Thefirstfish` is on a distinguished road
Default

Thank you again!

Based on your helpful advice, I solved those 3 problems and a few more. My macro is now getting quite large (about 1700 lines and growing daily).

I'm now stuck on a point concerning field codes...

The current version of my macro contains the following code, thanks to the previous information in this thread:

Quote:
'For replacing hyphens in numerical ranges with an en dash
Set oRng = ActiveDocument.Range
With oRng.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "[0-9]-[0-9]"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchWildcards = True
.Execute
End With
Do While oRng.Find.Found = True
If oRng.Characters(3).Font.Superscript = False Then
oRng.Characters(2).Text = Chr(150)
oRng.Collapse wdCollapseEnd
oRng.Find.Execute
End If
Loop
Is there a line I can add to this to make it ignore (i.e., make no changes to) text that contains a field code?

I'm grateful for your expert help with all of these questions. I'm enjoying dabbling in coding and the experience has inspired me to sign up to an 'Intro to Computer Science' course.
Reply With Quote