Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #8  
Old 01-03-2025, 12:52 PM
macropod's Avatar
macropod macropod is offline Paste from Clipboard, Find and Replace All, Then Copy Results Back to The Clipboard Windows 10 Paste from Clipboard, Find and Replace All, Then Copy Results Back to The Clipboard Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
paste from clipboard to selected paragraphs yacov Word VBA 5 02-04-2024 01:41 PM
Paste from Clipboard, Find and Replace All, Then Copy Results Back to The Clipboard Replicate the copy/paste function, without involving the clipboard alex100 Word VBA 8 11-09-2020 08:19 AM
Need to copy specific formated text from Word and paste from clipboard into a console application Userx Word VBA 0 10-09-2020 05:58 AM
Error with Clipboard - Getting Spaces Out of Clipboard StephenRay Word VBA 14 09-27-2017 01:07 PM
Paste from Clipboard, Find and Replace All, Then Copy Results Back to The Clipboard Find & selected paras with highlighted text & copy to clipboard marceepoo Word VBA 1 09-14-2012 08:20 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft