You can record a macro and then open the Macro IDE (Alt + F11) and put the pre-recorded macro in a loop as follows:
Sub TemporaryMacro() selection = DTE.ActiveDocument.Selection() anchorPoint = selection.AnchorPoint.CreateEditPoint selection.EndOfDocument(True) endPoint = selection.BottomPoint.CreateEditPoint() selection.MoveToPoint(anchorPoint) Do While True isEOF = DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint().Line = endPoint.Line If (isEOF) Then Exit Do End If ' Prerecorded macro DTE.ActiveDocument.Selection.Text = " " DTE.ActiveDocument.Selection.LineDown() DTE.ActiveDocument.Selection.CharLeft() ' End of prerecorder macro Loop End Sub
source share