Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing non-printing special character in Word

Status
Not open for further replies.

charlie39

MIS
Apr 19, 2002
4
US
I need to convert an ascii text file which contains a non-printing character (the bell code, ascii 7) into a Word document. I would like to convert the bell code into a printable character (such as a "~"). However, Word can not find the bell code in the document, although I can see it on the screen where it displays as a hollow box. If I copy the hollow box and then paste it into the Find box on the Word search screen, there is nothing there. I also tried searching for "^007", as suggested in the Word help files for search and replace, but this does not work either. Is there some limitation within Word in dealing with some of the non-printing characters?

p.s. One workaround that I have found is that I can do the conversion of the bell code to "~" using WordPad, and then do the rest of the conversion needed using Word macros. But I really want to do it all in Word if possible.
 
I tried the ^7 approach and it worked fine.

Have you checked other search-not-working-gotchas:
. do you have "no formatting" in the "Search/Replace"'s "Find what"?
. are you searching All or searching Down starting before the targets

Are you sure that it is a ^G/0x007/BEL character? Eg if you "type" it at the command prompt do you hear the beep?

I also found that if I do the reverse - change, say ~ to ^7 in Word I puts a CR/LF or something other than a bell char in there!
 
Your comment that the ^7 approach worked for you was most interesting. It definitely doesn't work for me and I am using Office XP (which has Word 2002). So I got to thinking, maybe the issue has something to do with changes that have been made by our good friends at Microsoft for the newest version of Word. Sure enough, after taking a copy of the data file home with me and opening it in Word 97, I had absolutely no problem finding and replacing the bell code. So something has changed in the latest version of Microsoft Word.

It appears that the latest release of Word is no longer able to find/replace some of the low-order non-printable ASCII characters (characters below ASCII 32) that may appear in text files generated by non-windows based software. Clearly it still can find and replace the tab character (ASCII 9) as well as the paragraph (CR/LF, ASCII 13/10), but I suspect that it will have problems dealing with other such non-printable characters based on the problems encountered here with the bell code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top