tags:

views:

38

answers:

1

Hi guys,

being in need to export a DOC file to TXT and then reimport it without losing bold and underline formatting I'd need a macro to do that.

My idea is to select each group of words in bold (could be a sentence or a single word in sentence) and then write say <$> before it and <$$> after it. When back in word the reverse should happen, i.e. all text between <$> and <$$> back to bold. The same macro works for underline and bold+underline. I tried to export doc to html, then open in an html editor and save as txt saving only the bold and underline tags. Perfect, if not for the CR LF that the editor puts at the end end of each line...

TIA, my macro programming skills are short of basic...

alberto

A: 

Could you provide some example document for the original file and file you processed? If it is only about CR and LF, you can replace them via VBA:

textasstring = Replace$(textasstring, vbCrLf, "") textasstring = Replace$(textasstring, vbLf, "")

Another solution is to take an editor which is able to support extended search and replace including \r and \n like notepad++.

da8
Thanks, that did the trick but I realized the way I took is far too complicated. Much simpler it would be to tell Word "put a symbol before any bold sentence and a different one at the end". I'm going in circles and I'm running short of programmimg fantasy so I guess I'll never make it by myself.
alberto

related questions