View Single Post
 
Old 11-09-2020, 08:19 AM
alex100 alex100 is offline Windows 7 64bit Office 2016
Advanced Beginner
 
Join Date: May 2020
Posts: 79
alex100 is on a distinguished road
Default

Quote:
Originally Posted by gmayor View Post
Could you clear RangeA after processing?
I'm afraid not, the space must be cleared before the processing starts.

So far I've been using this code, but like I said, it's messing up the clipboard...

Code:
Selection.Copy
Selection.Delete
'
' processing here...
'
Selection.Paste
Is there any other straightforward solution to replicate this copy/paste behaviour as close as possible?

I also thought about saving the original clipboard content to a variable before 'Selection.Copy', and then restore it back before the end of the macro. That would still be a decent solution, although not that elegant. But the clipboard can also contain binary information (not only text), and I could not find a way to do this in Word VBA. Saving from and writing back to clipboard text information is really no problem.

Alex
Reply With Quote