Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-21-2019, 06:06 PM
Lugh's Avatar
Lugh Lugh is offline What's this sign and how to remove it from my document? Windows 10 What's this sign and how to remove it from my document? Office 2016
Competent Performer
 
Join Date: May 2019
Location: USA
Posts: 137
Lugh is on a distinguished road
Default



Quote:
Originally Posted by Guessed View Post
Converting to text only is akin to throwing the baby out with the bathwater.
Agreed, we call it 'nuking' here

Your solutions are much better for one-off situations.

Quote:
Originally Posted by Wordfinder View Post
I didn't get understand what you mean of tag, would you please give more information about how to reserve the source formatting in my doc file after txt step?
This is just fyi, as Andrew's solutions above are much better for fixing one or two problems.

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
Post TXT Docx:
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
This approach might be less useful if your original documents are in good shape. It suits me as my input docs can be a mess, so I need to take a hammer and paintbrush to them one way or the other.
Reply With Quote
Reply



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
What's this sign and how to remove it from my document? How to Remove Equal-sign lines that cross the page arthur gatti Word 1 08-12-2015 12:53 PM
What's this sign and how to remove it from my document? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 02:29 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft