View Single Post
 
Old 11-09-2020, 04:02 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 macropod View Post
To use the 'FormattedText' property in anything like you describe, you'd have to use something like:
I have no doubt this is the right approach, but I have trouble implementing it in my own code. ;-) Here's what I have so far...

Code:
Dim RangeA As Range
Dim RangeB As Range

Set RangeA = Selection.FormattedText
Set RangeB = RangeA

'RangeA.Delete

Selection.Collapse
Selection.FormattedText = RangeB
The code works ok until I uncomment the 'RangeA.Delete' instruction. If I do that, RangeB is deleted together with RangeA, so in the end nothing will be written to the document.

Alex
Reply With Quote