How can I divide a shapes outline width in half (/2) using vba?
Myron said:How can I divide a shapes outline width in half (/2) using vba?
Look at Shape.Outline.Width.
So, something like s.Outline.Width = s.Outline.Width/2
If you look at the Object Properties docker, you can see that, when you do that, it is increasing the Outline Width, but also changing the Stretch and Tilt of the nib to get the vertical lines to render at the original outline width. Stretch does not go larger than 100%, so it does it that way.
After you have done that, I don't think the shape has any "memory" of what its old outline width used to be.
If you try going the other way - stretching that rectangle to make it narrower - then you can see that it keeps Outline.Width the same, but changes Stretch and Tilt of the nib to get the thinner vertical lines.
What's weird to me too is that if you convert the stretched rectangle to curves then use the shape tool to delete all the line segments except for the top, it still shows the line width to be the larger number even though you can visually see that it is still .25". Now convert outline to object, thickness is a lot closer to the original .25".
My thought was that if it were possible to get the thickness of the thinnest line segment with vba then apply that same to the whole shape.
select shape and run macro
Sub Macro1() Dim OrigSelection As ShapeRange, a#, b# Set OrigSelection = ActiveSelectionRange a = OrigSelection(1).Outline.Width b = OrigSelection(1).Outline.NibStretch OrigSelection(1).Outline.Width = a * b / 100 OrigSelection(1).Outline.NibStretch = 100End Sub