![]() |
|
#10
|
||||
|
||||
|
Quote:
![]() Your solutions are much better for one-off situations. Quote:
I deal with long documents—typically 25-100K words—which may have been thru a lot of different OSs and WP programs. After a frustrating year of trying to track down weird and wonderful problems, I developed a 'nuke and rebuild' process. Essentially it's a bunch of Global Replace macros before and after the TXT step. So to preserve all italics: Original doc: Find all italic text; Replace each instance with [startItalic]Found Text[EndItalic]. The square brackets' content are the 'tags' I mentioned, they can be anything you like as long as they are unique—ie won't match any legit content. Code:
Sub IdentifyItalic()
'Surround Italic text with ItalicStart and ItalicEnd to identify it when formatting is stripped.
Selection.Find.ClearFormatting
Selection.Find.Font.Italic = True
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = "ItalicStart^&ItalicEnd"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
Find all the text tagged above, using Wildcards; Make it Italic; A later routine deletes all tags and changes direct formatting to styles. Code:
Sub ItalicRestore()
'Restore Italics [blue for visibility disabled due to problem caused for BaseFix routine]
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find.Replacement.Font
.Italic = True
' .Color = wdColorBlue
End With
With Selection.Find
.Text = "ItalicStart*ItalicEnd"
.Replacement.Text = "^&"
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need to remove Document Type list from document | parsonsv | Word | 2 | 05-15-2017 07:23 AM |
How to Remove Equal-sign lines that cross the page
|
arthur gatti | Word | 1 | 08-12-2015 12:53 PM |
How to make a sign in sheet?
|
Queenofmycastle | OneNote | 2 | 06-29-2015 08:48 AM |
| How to sign out from the outlook? | Jamal NUMAN | Outlook | 0 | 11-21-2010 07:28 PM |
| paragraph sign appearing in document | ajetrumpet | Word | 1 | 08-24-2010 05:46 AM |