Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
TV TV is offline
external usenet poster
 
Posts: 2
Default Shapes and VBA in Excel 2000 and 2002

I have a large amount of shape-groups that I want to manipulate by
VBA.
All the groups are basicly the same structure and consists of several
other shape-groups. So my structure looks something like this
(simplified):

Group "Group AA1" contains groups named: "Subgroup SS1" and "Subgroup
SS2" each containing shapes named: "Line1" and "Line2"
Group "Group AA2" also contains groups named: "Subgroup SS1" and
"Subgroup SS2" each again containing shapes named: "Line1" and "Line2"

The task is to access a specific subgroup whitin a maingroup - and
return this group as a shape-object.

This code works in Xl 2000:

-----
Public Function SubShape(ByVal ParentShape As Shape, sID As String) As
Shape
Dim i As Integer

With ParentShape
For i = 1 To .GroupItems.Count 'Evaluates to 2
If .GroupItems(i).Name = sID Then
Set SubShape = .GroupItems(i)
Exit For
End If
Next i
End With

End Function

---------
Sub ShapeTest()

Dim AllShapes As Shapes
Dim MainShape As Shape
Dim MyShape As Shape

Set AllShapes = ActiveSheet.Shapes
Set MainShape = AllShapes("Group AA1")

Set MyShape = SubShape(MainShape, "Subgroup SS1")

End Sub

BUT in Xl 2002 (v10):
GroupItems.Count evalutes to 4 (Number of lines) and it is not
possible - or is it - to return the embedded shape-group.

ANY idea to overcome the problem - preferebly in a way that works both
in Xl2000 and Xl2002 - and maybe even in a later version.
Deadline is closing so any help appreciated.

Thomas Voetmann
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Shapes and VBA in Excel 2000 and 2002

Hate to tell you this, but your functions worked fine for me in Excel
2002, SP3. It's tough to troubleshoot

What service pack do you have?

Also, I think the Count is immaterial since you are testing each shape
for the Name. But if you want to ship testing Lines then you could
wrap the inner code with "If .GroupItems(i).AutoShapeType < -2 Then".

  #3   Report Post  
Posted to microsoft.public.excel.programming
TV TV is offline
external usenet poster
 
Posts: 2
Default Shapes and VBA in Excel 2000 and 2002

"Nick Hebb" wrote in message ups.com...
Hate to tell you this, but your functions worked fine for me in Excel
2002, SP3. It's tough to troubleshoot

What service pack do you have?


Have tested it in SP0 and SP3 - same problem


Also, I think the Count is immaterial since you are testing each shape
for the Name. But if you want to ship testing Lines then you could
wrap the inner code with "If .GroupItems(i).AutoShapeType < -2 Then".


Great idear to use AutoShapeType, but
in Excel 2000 I get two groupitems, each has AutoShapeType -2 and
named Subgroup SS1 and Subgroup SS2
in Excel XP I get four groupitems, each has also AutoShapeType -2 and
named Line 1 etc.
I am confused - dont know about you.

I also tried the parrent property without luck.

Thanks anyway.

Thomas Voetmann
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 2000 to 2002 - #NAME? Paulo Freixieiro Excel Discussion (Misc queries) 6 September 7th 05 01:33 PM
Excel 2000 to 2002 - #NAME? Paulo Freixieiro Excel Discussion (Misc queries) 1 September 7th 05 01:12 AM
Excel 2000 and 2002 Tim Childs Excel Programming 3 October 22nd 03 01:23 AM
Excel 2000-2002 compability Chrissy[_4_] Excel Programming 5 August 3rd 03 04:24 AM


All times are GMT +1. The time now is 06:31 AM.

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"