Trouble setting up Text properties VBA

Hello,

I'm trying to create a macro for X6 that will set up various text settings in CorelDraw. Some of them are available in the Object Parameters docker in the Character section. I figured out that these are stored in the Sty.Character.Style Properties. I successfully managed to create a macro that read these. Now I know which ones to change and what values should I assign. The problem is I cannot set these. The snippet below is supposed to assign values to 6 Params and then reads them. Problem is they remain unchanged. Any idea why?

Dim my_object As Shape
For Each my_object In ActiveSelectionRange.Shapes
If my_object.Type = cdrTextShape Then
my_object.Style.Character.Style.SetProperty "kern", 1
my_object.Style.Character.Style.SetProperty "lnum", 1
my_object.Style.Character.Style.SetProperty "onum", 0
my_object.Style.Character.Style.SetProperty "palt", 1
my_object.Style.Character.Style.SetProperty "pnum", 1
my_object.Style.Character.Style.SetProperty "tnum", 0

MsgBox my_object.Style.Character.Style.GetPropertyAsString("kern") & " " & _
my_object.Style.Character.Style.GetPropertyAsString("lnum") & " " & _
my_object.Style.Character.Style.GetPropertyAsString("onum") & " " & _
my_object.Style.Character.Style.GetPropertyAsString("palt") & " " & _
my_object.Style.Character.Style.GetPropertyAsString("pnum") & " " & _
my_object.Style.Character.Style.GetPropertyAsString("tnum")
End If
Next my_object

Regards, Paul

Parents
No Data
Reply
  • Guys, thank you for your suggestions. They did not help me directly, but at least inspired me to look in proper place. The solution is:

    Instead of changing properties here:

    my_object.Style.Character.Style.SetProperty "kern", 1

    One has to change it here:

    my_object.Text.Story.ObjectStyle.Character.Style.SetProperty "kern", 1

    And then the all of the sudden:

    MsgBox my_object.Style.Character.Style.GetPropertyAsString("kern")

    will print "1" instead of any random value. Text kerning changes too.

Children
No Data