Object Model Reference : Classes : T : TextRange : Methods : TextRange.Combine |
Sub Combine(Range As TextRange)
Member of TextRange
The Combine method combines the current text range with a specified range.
The following VBA example stores the fourth word and the second line in separate text ranges. It duplicates the fourth word and combines it with the text range for the second line. Bold formatting is applied to the fourth word, and the second line is underlined. The combined text range is then filled with red.
Sub Test() |
Dim t As Text |
Dim s As Shape |
Dim trLine As TextRange |
Dim trWord As TextRange |
Dim tr As TextRange |
Dim d As Document |
Set d = CreateDocument |
Set s = d.ActiveLayer.CreateParagraphText(2, 2, 4, 4, _ |
"This is a line 1." & vbCr & "This is line 2.") |
Set t = s.Text |
Set trWord = t.Story.Words(4) |
Set trLine = t.Story.Lines(2) |
Set tr = trWord.Duplicate |
tr.Combine trLine |
trWord.Bold = True |
trLine.Underline = cdrSingleThickFontLine |
tr.Fill.UniformColor.RGBAssign 155, 0, 0 |
End Sub |
Copyright 2013 Corel Corporation. All rights reserved.