Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel 2003 - Shapes

App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of Shape
these are (i.e, Texbox, Picture, Comment etc.)

Many thanks in advance

Regards
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default Excel 2003 - Shapes

Mike,
Search up (VBA-View-)ObjectBrowser for msoShapeType.
--
Petr Bezucha


"Mike Faulkner" wrote:

App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of Shape
these are (i.e, Texbox, Picture, Comment etc.)

Many thanks in advance

Regards
Mike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel 2003 - Shapes

"Mike Faulkner" wrote in message
...
App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of
Shape
these are (i.e, Texbox, Picture, Comment etc.)


Hi Mike,

The Shape.Type property returns the value of one of the msoShapeType
enumeration members. You can view these members using the Object Browser
(press F2 in the Visual Basic Editor). There's no quick way to look up a
specific number, you just have to select msoShapeType from the list on the
left and then select each enumeration member from the list on the right and
see if its value corresponds to the one you're looking for. For the ones you
mention:

1 = msoAutoShape
13 = msoPicture
17 = msoTextBox

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel 2003 - Shapes

Hello

Many thanks for the replies.

I want to loop through the msoShapeType collection extracting the type of
Shape (i.e. 17 = Textbox, 13=Picture etc.)

Regards
Mike

"PBezucha" wrote:

Mike,
Search up (VBA-View-)ObjectBrowser for msoShapeType.
--
Petr Bezucha


"Mike Faulkner" wrote:

App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of Shape
these are (i.e, Texbox, Picture, Comment etc.)

Many thanks in advance

Regards
Mike

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Excel 2003 - Shapes

Rob

Many thanks.

Regards
Mike

"Rob Bovey" wrote:

"Mike Faulkner" wrote in message
...
App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of
Shape
these are (i.e, Texbox, Picture, Comment etc.)


Hi Mike,

The Shape.Type property returns the value of one of the msoShapeType
enumeration members. You can view these members using the Object Browser
(press F2 in the Visual Basic Editor). There's no quick way to look up a
specific number, you just have to select msoShapeType from the list on the
left and then select each enumeration member from the list on the right and
see if its value corresponds to the one you're looking for. For the ones you
mention:

1 = msoAutoShape
13 = msoPicture
17 = msoTextBox

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default Excel 2003 - Shapes

"Mike Faulkner" wrote in message
...
I want to loop through the msoShapeType collection extracting the type of
Shape (i.e. 17 = Textbox, 13=Picture etc.)


Hi Mike,

While there's no built-in way to loop the msoShapeType enumeration
members, you can create something similar with an If...Then or Select Case
block in your code. Here's an example using Select Case:

Sub ShapeType()

Dim objShape As Shape

For Each objShape In ActiveSheet.Shapes
Select Case objShape.Type
Case 1 ''' AutoShape
''' Do something here
Case 13 ''' Picture
''' Do something here
Case 17 ''' TextBox
''' Do something here
Case Else
''' None of the above.
End Select
Next objShape

End Sub

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Excel 2003 - Shapes

If you use Shape.Name along with the type, it will give you triangle,
rectangle, etc.

"Mike Faulkner" wrote:

Rob

Many thanks.

Regards
Mike

"Rob Bovey" wrote:

"Mike Faulkner" wrote in message
...
App: Excel 2002
OS: WinXP

Looping through the Shapes collection in a Worksheet I get three different
Types returned (i.e. 13, 17 & 1) . How can I then identify what Type of
Shape
these are (i.e, Texbox, Picture, Comment etc.)


Hi Mike,

The Shape.Type property returns the value of one of the msoShapeType
enumeration members. You can view these members using the Object Browser
(press F2 in the Visual Basic Editor). There's no quick way to look up a
specific number, you just have to select msoShapeType from the list on the
left and then select each enumeration member from the list on the right and
see if its value corresponds to the one you're looking for. For the ones you
mention:

1 = msoAutoShape
13 = msoPicture
17 = msoTextBox

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm



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
excel document with shapes on it but the shapes do not print [email protected] Excel Worksheet Functions 2 October 22nd 09 06:17 PM
How Do I ... select multiple shapes in Excel 2007 (similar to 2003 Barb Reinhardt Excel Discussion (Misc queries) 1 July 30th 08 11:00 PM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Cursor Shapes for Excel 2003 Darryl Excel Worksheet Functions 1 October 7th 05 10:36 AM


All times are GMT +1. The time now is 07:40 PM.

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

About Us

"It's about Microsoft Excel"