View Single Post
 
Old 01-03-2025, 12:52 PM
macropod's Avatar
macropod macropod is online now Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,387
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You still haven't given any context, so it's impossible to know what the best way of handling the task is. All this copying, pasting & cutting seems to be a lot of pointless circumlocution.

That said, the code could be reduced to:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Rng As Range: Set Rng = ActiveDocument.Range(0, 0)
With Rng
  .PasteSpecial DataType:=wdPasteText
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Execute Findtext:="[<>#]", ReplaceWith:="-", MatchWildcards:=True, Forward:=True, Wrap:=wdFindStop, Replace:=wdReplaceAll
  End With
  .Cut
End With
Set Rng = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote