Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Shapes: identifying different types (charts, textboxes, pictures e

Since I use various shapes quite a lot so I use a form. I get the list of the
shapes on a sheet very simply:
For Each Shape In ActiveSheet.Shapes
ListBox1.AddItem (Shape.name)
Next Shape
I have controls where I can set margins, add/modify alternative text and
shape names, convert Textboxes to Pictures etc.

Now the problem. My list contains all the TextBoxes, Charts, Rectangles,
Pictures and Ovals. And I noticed yesterday if I have any filters on, the
DropDowns are there too and create all sorts of trouble if I select them!
How can I filter the different types of Shape so my list will only show the
type I want? I'll use checkboxes I guess but what code can I use to recognise
a Picture from a chart or an activeX control from a yellow oval?

Thanks for any assistance.
--
WinXP - Office2003 (Italian)
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Shapes: identifying different types (charts, textboxes, pictures e

Dim shp As Shape
Dim shpType As MsoShapeType

'code

shpType = shp.Type
If shpType = msoFormControl Then
If TypeName(shp.DrawingObject) = "DropDown" Then
'probably a filter arrow
Else
' a Forms control
Elseif

There are (from memory) 17 shapeTypes, maybe use Select case to group
similar types.

Regards,
Peter T

"David Macdonald" wrote in
message ...
Since I use various shapes quite a lot so I use a form. I get the list of
the
shapes on a sheet very simply:
For Each Shape In ActiveSheet.Shapes
ListBox1.AddItem (Shape.name)
Next Shape
I have controls where I can set margins, add/modify alternative text and
shape names, convert Textboxes to Pictures etc.

Now the problem. My list contains all the TextBoxes, Charts, Rectangles,
Pictures and Ovals. And I noticed yesterday if I have any filters on, the
DropDowns are there too and create all sorts of trouble if I select them!
How can I filter the different types of Shape so my list will only show
the
type I want? I'll use checkboxes I guess but what code can I use to
recognise
a Picture from a chart or an activeX control from a yellow oval?

Thanks for any assistance.
--
WinXP - Office2003 (Italian)



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Shapes: identifying different types (charts, textboxes, pictures e

the way I usally solve this problem is with the code below. The type will
tell you what the object is. YOu can also get the oleboject fro the shape.


Sub shapes()

For Each Shape In ActiveSheet.shapes
MsgBox (Shape.Name & " : " & Shape.Type)
If Shape.Type = msoOLEControlObject Then
Set obj = ActiveSheet.OLEObjects(Shape.Name)
End If
Next Shape

End Sub

"David Macdonald" wrote:

Since I use various shapes quite a lot so I use a form. I get the list of the
shapes on a sheet very simply:
For Each Shape In ActiveSheet.Shapes
ListBox1.AddItem (Shape.name)
Next Shape
I have controls where I can set margins, add/modify alternative text and
shape names, convert Textboxes to Pictures etc.

Now the problem. My list contains all the TextBoxes, Charts, Rectangles,
Pictures and Ovals. And I noticed yesterday if I have any filters on, the
DropDowns are there too and create all sorts of trouble if I select them!
How can I filter the different types of Shape so my list will only show the
type I want? I'll use checkboxes I guess but what code can I use to recognise
a Picture from a chart or an activeX control from a yellow oval?

Thanks for any assistance.
--
WinXP - Office2003 (Italian)

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default Shapes: identifying different types (charts, textboxes, pictures e

Check out the below link
http://www.mvps.org/dmcritchie/excel/shapes.htm

If this post helps click Yes
---------------
Jacob Skaria


"David Macdonald" wrote:

Since I use various shapes quite a lot so I use a form. I get the list of the
shapes on a sheet very simply:
For Each Shape In ActiveSheet.Shapes
ListBox1.AddItem (Shape.name)
Next Shape
I have controls where I can set margins, add/modify alternative text and
shape names, convert Textboxes to Pictures etc.

Now the problem. My list contains all the TextBoxes, Charts, Rectangles,
Pictures and Ovals. And I noticed yesterday if I have any filters on, the
DropDowns are there too and create all sorts of trouble if I select them!
How can I filter the different types of Shape so my list will only show the
type I want? I'll use checkboxes I guess but what code can I use to recognise
a Picture from a chart or an activeX control from a yellow oval?

Thanks for any assistance.
--
WinXP - Office2003 (Italian)

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Shapes: identifying different types (charts, textboxes, pictures e

Ron de Bruin has lots of info (and code samples) he
http://www.rondebruin.nl/controlsobjectsworksheet.htm



David Macdonald wrote:

Since I use various shapes quite a lot so I use a form. I get the list of the
shapes on a sheet very simply:
For Each Shape In ActiveSheet.Shapes
ListBox1.AddItem (Shape.name)
Next Shape
I have controls where I can set margins, add/modify alternative text and
shape names, convert Textboxes to Pictures etc.

Now the problem. My list contains all the TextBoxes, Charts, Rectangles,
Pictures and Ovals. And I noticed yesterday if I have any filters on, the
DropDowns are there too and create all sorts of trouble if I select them!
How can I filter the different types of Shape so my list will only show the
type I want? I'll use checkboxes I guess but what code can I use to recognise
a Picture from a chart or an activeX control from a yellow oval?

Thanks for any assistance.
--
WinXP - Office2003 (Italian)


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
fill a shape with pictures based on the shapes boundries pacsol_mic[_2_] Excel Programming 1 April 6th 09 11:54 AM
Add and delete pictures and shapes jlclyde Excel Discussion (Misc queries) 2 October 22nd 08 02:54 PM
Problem - Shapes.Textboxes JMay Excel Discussion (Misc queries) 2 April 22nd 07 10:28 PM
manipulating displayed pictures: can I rename the various Shapes to make coding easier. B J W Excel Programming 3 November 29th 04 06:28 AM
Identifying cell types in column using .SpecialCells(xlConstants, xlNumbers) robbinma[_4_] Excel Programming 2 January 21st 04 02:34 AM


All times are GMT +1. The time now is 11:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"