T
Top Spin
I wrote the little macro (shown below) to increase the paragraph
"spacing before" setting by 6 points.
It works just fine except when the line spacing is set to "Auto". In
that case, the Selection.ParagraphFormat.SpaceBefore value is "5".
Why is that? I can't find anything "space before" or "Auto" in the
help file.
Since the macro isn't testing for "5", it goes ahead and increments it
by 6. This causes the setting to change as the macro reads it, but if
I click on Format / Paragraph, it still shows "Auto".
What the heck is going on here?
Thanks
Here's the code:
-------------------------------------------
Sub IncLineSpaceBef6pts()
Dim setting As Single, reply As Long, msg As String
setting = Selection.ParagraphFormat.SpaceBefore
If setting < 999 Then 'If the selection is all the same setting,
'increase it by 6
Selection.ParagraphFormat.SpaceBefore = setting + 6
Else 'Otherwise, ask for instructions
msg = "The selection contains multiple Space Before settings. " _
& "Set them all to 6?"
reply = MsgBox(msg, vbYesNoCancel + vbDefaultButton2,
"SpaceBeforeToggle macro")
If reply = vbYes Then 'If they say yes, set them all to 6
Selection.ParagraphFormat.SpaceBefore = 6
End If 'Otherwise, do nothing
End If
End Sub
"spacing before" setting by 6 points.
It works just fine except when the line spacing is set to "Auto". In
that case, the Selection.ParagraphFormat.SpaceBefore value is "5".
Why is that? I can't find anything "space before" or "Auto" in the
help file.
Since the macro isn't testing for "5", it goes ahead and increments it
by 6. This causes the setting to change as the macro reads it, but if
I click on Format / Paragraph, it still shows "Auto".
What the heck is going on here?
Thanks
Here's the code:
-------------------------------------------
Sub IncLineSpaceBef6pts()
Dim setting As Single, reply As Long, msg As String
setting = Selection.ParagraphFormat.SpaceBefore
If setting < 999 Then 'If the selection is all the same setting,
'increase it by 6
Selection.ParagraphFormat.SpaceBefore = setting + 6
Else 'Otherwise, ask for instructions
msg = "The selection contains multiple Space Before settings. " _
& "Set them all to 6?"
reply = MsgBox(msg, vbYesNoCancel + vbDefaultButton2,
"SpaceBeforeToggle macro")
If reply = vbYes Then 'If they say yes, set them all to 6
Selection.ParagraphFormat.SpaceBefore = 6
End If 'Otherwise, do nothing
End If
End Sub