R
rafraf
Best way to explain this problem is to demonstrate it. I have only
tried this with Word 2003 SP2.
In a block of three paragraphs, select the first and last paragraph (do
not select the middle paragraph) using ctrl-click. Now execute the
following macro:
Sub WorksWhenSelectionDiscontinuous()
Selection.Paragraphs.Indent
End Sub
As expected, the two paragraphs in your selection indent.
Now try this code with the same selection:
Sub DoesNotWorkWhenSelectionDiscontinuous()
Dim para As Paragraph
For Each para In Selection.Paragraphs
para.Indent
Next para
End Sub
This time, only the last paragraph in the selection indents. Note that
if you select all three paragraphs continuously (i.e. without the ctrl
key) then all paragraphs in the selection will, as expected, indent.
Can anyone explain or provide a workaround*?
*By workaround I mean a way of performing an action on each paragraph
in the selection such that I can do different things based on the
attributes of each paragraph in the (discontinuous) selection.
Cheers all.
tried this with Word 2003 SP2.
In a block of three paragraphs, select the first and last paragraph (do
not select the middle paragraph) using ctrl-click. Now execute the
following macro:
Sub WorksWhenSelectionDiscontinuous()
Selection.Paragraphs.Indent
End Sub
As expected, the two paragraphs in your selection indent.
Now try this code with the same selection:
Sub DoesNotWorkWhenSelectionDiscontinuous()
Dim para As Paragraph
For Each para In Selection.Paragraphs
para.Indent
Next para
End Sub
This time, only the last paragraph in the selection indents. Note that
if you select all three paragraphs continuously (i.e. without the ctrl
key) then all paragraphs in the selection will, as expected, indent.
Can anyone explain or provide a workaround*?
*By workaround I mean a way of performing an action on each paragraph
in the selection such that I can do different things based on the
attributes of each paragraph in the (discontinuous) selection.
Cheers all.