para.Range.MoveStart Unit: wdCharacter , Count:=-1
Should be :
para.Range.MoveStart Unit:= wdCharacter , Count:=-1
Your code is simply wrong and will clear all contents after execution! Try this code first plz:
Sub removelinebreak()
Dim rng As Range
Dim para As Paragraph
Dim ur As UndoRecord
Set ur = Word.Application.UndoRecord
ur.StartCustomRecord "removelinebreak"
…
Top comments (0)