PDA

View Full Version : Increasing line spacing by a (non) integer number



askou
06-22-2015, 08:48 PM
Hi All,

I am trying to create a macro that increases line spacing (i.e. spacewithin) by 0.1 pts. The code I have written so far is:

Sub Macro8(control As IRibbonControl)
Dim Shp As Shape
If ActiveWindow.Selection.Type = ppSelectionNone Then
' Nothing!
Else
For Each Shp In ActiveWindow.Selection.ShapeRange
With Shp
.TextFrame2.TextRange.ParagraphFormat.LineRuleWithin = msoTrue
.TextFrame2.TextRange.ParagraphFormat.SpaceWithin = .TextFrame2.TextRange.ParagraphFormat.SpaceWithin + 0.1
End With
Next Shp
End If
End Sub

Issue is that when the code runs linespacing becomes 0.1 instead of increasing by 0.1. While I can set directly line spacing to a particular non integer value such as 1.2, it seems impossible to increase it by 0.1 or a non integer number.

Has anybody encountered a similar problem or has a recommendation on how to solve it?

Thanks,
Andreas

John Wilson
06-23-2015, 08:48 AM
To set the line spacing to a given number of points .LineRuleWithin should be set to False however it seems buggy. Try omitting that line altogether

askou
06-25-2015, 04:55 AM
Yes it worked John! Thank you very much for this response!

Best,
Andreas