L
LJ
hi,
I would like be able to tell with VBA code whether the current
selection is an image(s) OR is a section that user has dragged the
mouse around and happens to contain an image(s).
(basically, the code should be able to distinguish whether the
selection has non-images, like just some plain text, or is the
selection all InlineShapes or Shapes?)
my attempt as follows, which doesn't work quite right when the
selection happens to have one image, along with some plain text. is
there a better way?
Dim iSectionsCount As Integer =
app.ActiveWindow.Selection.Range.Sections.Count
Dim iInlineShapesCount As Integer =
app.ActiveWindow.Selection.InlineShapes.Count
Dim iShapeRangeCount As Integer =
app.ActiveWindow.Selection.ShapeRange.Count
bJustImages = False
If True Then
If iSectionsCount = iInlineShapesCount Then
bJustImages = True
ElseIf iInlineShapesCount = 0 Then
If iSectionsCount = iShapeRangeCount Then
bJustImages = True
End If
End If
End If
thanks in advance,
lj
I would like be able to tell with VBA code whether the current
selection is an image(s) OR is a section that user has dragged the
mouse around and happens to contain an image(s).
(basically, the code should be able to distinguish whether the
selection has non-images, like just some plain text, or is the
selection all InlineShapes or Shapes?)
my attempt as follows, which doesn't work quite right when the
selection happens to have one image, along with some plain text. is
there a better way?
Dim iSectionsCount As Integer =
app.ActiveWindow.Selection.Range.Sections.Count
Dim iInlineShapesCount As Integer =
app.ActiveWindow.Selection.InlineShapes.Count
Dim iShapeRangeCount As Integer =
app.ActiveWindow.Selection.ShapeRange.Count
bJustImages = False
If True Then
If iSectionsCount = iInlineShapesCount Then
bJustImages = True
ElseIf iInlineShapesCount = 0 Then
If iSectionsCount = iShapeRangeCount Then
bJustImages = True
End If
End If
End If
thanks in advance,
lj