View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Nick Hebb[_2_] Nick Hebb[_2_] is offline
external usenet poster
 
Posts: 12
Default I have a problem with determining if a shape is selected.

AndyT,

Here is a function I developed to test the Selection. It's non-
production as of now, so I haven't fully tested it.

==================================================
Public Function IsSelectionAShape() As Boolean

Dim isShape As Boolean
Dim sType As String

sType = TypeName(Application.Selection)

' eliminate the obvious / most frequent case
If sType < "Range" Then
Select Case sType
' Delete any you don't want to test for
Case "Arc": isShape = True ' autoshape -
special case
Case "Drawing": isShape = True ' freeform or
scribble
Case "DrawingObjects": isShape = True ' grouped shapes
Case "GroupObject": isShape = True ' diagram - org
chart, target, radial, etc.
Case "Line": isShape = True ' line or arrow
(non-Connector)
Case "OLEObject": isShape = True ' on sheet VB
control
Case "Oval": isShape = True ' autoshape -
special case
Case "Picture": isShape = True ' picture
Case "Rectangle": isShape = True ' applies to most
shapes
Case "TextBox": isShape = True ' textbox or
visible cell comment
Case "ChartObject": isShape = True ' chart
Case Else: isShape = False
End Select
End If
IsSelectionAShape = isShape

End Function
==================================================


HTH,

Nicholas Hebb
BreezeTree Software
http://www.breezetree.com