View Single Post
 
Old 11-08-2020, 05:50 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

Thank you for your suggestion, Paul! Using the 'FormattedText' property, I came up with this code...

Code:
Dim Content As Range
Set Content = Selection.FormattedText
  
Selection.Collapse
Selection.FormattedText = Content
It's working fine, except for one thing... After I copy the content, I'd like to also quickly delete it, and then (after more macro processing) write it back to the document.

Something like the code below, which obviously doesn't work. I'm just writing it so that you can understand what I'm looking for...

Code:
Dim Content As Range
Set Content = Selection.FormattedText

Content.Delete

'
' more processing takes place here...
'

Selection.Collapse
Selection.FormattedText = Content
I tried using two different range names for the content, so when I delete one of them, the other can still be saved. But it didn't work...

How can I achieve something like this, please? Save the content, delete it, and then later after more processing write it back?

Alex
Reply With Quote