0
votes

I'm using this macro to clear all text format and paste it to another document:

Selection.Copy
Windows(1).Activate
Selection.PasteAndFormat (wdFormatPlainText)

It works fine, but I need plain text with information about bolded characters as red color. In other words - I need to remove all text formatting but make bolded characters red. I was trying to iterate Selection char by char, but without success.

1
My decision was. 1. In text mark format insert before and and of format some characters like this %%% bold %%% (was bold) 2. Copy and paste as text 3. Find and replece text between %% ... %% as you need formatIvan.s

1 Answers

0
votes

remove all formatting is impossible but set style to normal can.

 Selection.Copy
 Windows(1).Activate
 Windows(1).Document.Bookmarks.Add ("xx")
 Selection.PasteAndFormat (wdFormatPlainText)
 Windows(1).Document.Bookmarks.Add ("xxx")
 Selection.Start = Windows(1).Document.Bookmarks.Item(1).Start
 Selection.End = Windows(1).Document.Bookmarks.Item(2).Start
 Selection.Style = wdStyleNormal
 Selection.Font.Bold = True
 Selection.Font.Color = wdColorRed
 Windows(1).Document.Bookmarks.Item(1).Delete
 Windows(1).Document.Bookmarks.Item(1).Delete