I had a simple macro in Corel 2020 to toggle the outline on and off. Since I updated to 2023 I've been getting a weird bug.If there is no outline, it's creating an outline in inches. instead of 0.5pts default. What am I missing?
Sub Toggle_Outline() Dim s As Shape For Each s In ActiveSelectionRange.Shapes If s.Outline.Width > 0 Then s.Outline.SetNoOutline ElseIf s.Outline.Width = 0 Then 's.Outline.SetProperties 1 <-----Was working in 2020. s.Outline.SetProperties 0.5 'tried to change to 0.5pt but makes a outline .5" wide. End If Next s End Sub
Found this convert units code and this fixed the issue. https://community.coreldraw.com/talk/coreldraw_graphics_suite_x6/f/coreldraw-x6/39529/units-in-vba
Sub Toggle_Outline() Dim s As Shape Dim x As Double x = ConvertUnits(0.5, cdrPoint, cdrInch) For Each s In ActiveSelectionRange.Shapes If s.Outline.Width > 0 Then s.Outline.SetNoOutline ElseIf s.Outline.Width = 0 Then s.Outline.SetProperties x End If Next s End Sub
or
s.Outline.SetProperties 0.5/72