Hello, I'm trying to use VB macro to set Text Properties in CorelDraw. I can successfully read all of them, but I cannot set any. Any idea how to do it? Regards, Paul
Please, try the next way:
1 2 3 4 5 6 7 8 9 10
Sub testSetKerning() Dim sh As Shape Set sh = ActiveShape sh.Text.FontProperties.RangeKerning = 100 With sh.Text.Story .WordSpacing = 200 .CharSpacing = 10 .LineSpacing = 150 End With End Sub
Select a text box having two lines, try running the code line by line, pressing F8 (with VBE window small enough) and see what's happening
You can reset the characters spacing using the next code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
Sub ResetCharSpacing() Dim tr As TextRange If ActiveShape Is Nothing Then MsgBox "Nothing selected", vbCritical Exit Sub End If If ActiveShape.Type <> cdrTextShape Then MsgBox "Make sure the a object is selected", vbCritical Exit Sub End If If ActiveShape.Text.IsEditing Then Set tr = ActiveShape.Text.Selection MsgBox "Unable to reset Range Kerning for selection", vbExclamation Else Set tr = ActiveShape.Text.Story ActiveShape.Text.FontProperties.RangeKerning = 0 End If tr.WordSpacing = 100 tr.CharSpacing = 0 tr.LineSpacing = 100 End Sub
Thank you for the suggestion, but its not the thing I was looking for. I need to change type of kerning schema, not the kerning spacing.
It seems that admin has reverted my initial post - the one that has been removed by anti spam bot. I will continue the discussion in the thread #64252
Can you explain what you mean by "kerning schema"? What else than spacing are you referring to?
I don't have English version of UI installed, so I don't know how exactly it is called in English. See the attached picture.
In all of the cases above spacing values are exactly the same.