25 Years of Programming
An open source source for C, C++, OWL, BASIC, MDB, XLS, DOT, and more...
Home   Projects   Up   Sitemap   Search   Blog   Forum+Chat   About Us   Privacy   Terms of Use   Feedback   FAQ   Images   Services   Ads   Donate   Humor

Microsoft Word 6.0 macro to remove backspace characters embedded in a file

Old disk files containing text from modem capture buffer routines often contain embedded backspace characters intermingled with the characters they backspaced over. Example: this^H^Hese. This macro removes the backspace characters and the characters they backspaced over, leaving only the final-form text.

StripBackspaceChars

Removes backspace chars and the chars they backspaced over.  For cleaning up log files of modem sessions.

Sub MAIN
REM 11-24-99
REM Copyright (C)1999 Steven Whitney.
REM Initially published by http://25yearsofprogramming.com.
REM Published under GNU GPL (General Public License) Version 2, with ABSOLUTELY NO WARRANTY.
REM REMOVES FROM A FILE ALL BACKSPACE CHARS AND THE CHARS THEY BACKSPACED OVER.
REM FOR CLEANING UP LOG FILES OF MODEM SESSIONS.
StartOfDocument
EditFindClearFormatting
EditFind .Find = "^0008", .Direction = 0, .MatchCase = 0, .WholeWord = 0, .PatternMatch = 0, .SoundsLike = 0, .Format = 0, .Wrap = 0
While EditFindFound()
	EditClear			REM delete the backspace
	CharLeft 1, 1		REM select the char to the left
	EditClear			REM and delete it, too
	RepeatFind
Wend
End Sub

 

 

Valid HTML 4.01 Transitional Valid CSS
View content labeling at ICRA.
Copyright ©2007 Steven Whitney. Last modified 09/25/2007.