Discussion:
selected item in a group in powerpoint
(too old to reply)
Staroslav
2006-11-07 09:13:02 UTC
Permalink
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.

Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
John Wilson
2006-11-07 09:56:01 UTC
Permalink
Be easier if we could see your code

I guess you know how to name items before you group using vba so do that

Them something like (air code not tested!)

Dim ogp as shape
For Each ogp In ActiveWindow.Selection.ShapeRange.GroupItems
If ogrp.name=*** Then
do whatever
End if
Next
--
Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
Post by Staroslav
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.
Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Staroslav
2006-11-07 11:41:02 UTC
Permalink
Naming items in a group in my case is not an option.

Here is part of the code, but I can't identify a selected cell.

Case msoGroup
' If it's a group them iterate thru the items and list them
For Ctr = 1 To .GroupItems.Count
'The next condition needs to identify the item that has the
cursor or
' is selected otherwise.
If .GroupItems(Ctr) ??????? Then
.GroupItems(Ctr).Fill.ForeColor.RGB = RGB(0, 0, 0)
End If
Next Ctr
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Post by John Wilson
Be easier if we could see your code
I guess you know how to name items before you group using vba so do that
Them something like (air code not tested!)
Dim ogp as shape
For Each ogp In ActiveWindow.Selection.ShapeRange.GroupItems
If ogrp.name=*** Then
do whatever
End if
Next
--
Did that answer the question / help?
_____________________________
John Wilson
Microsoft Certified Office Specialist
http://www.technologytrish.co.uk/ppttipshome.html
Post by Staroslav
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.
Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Shyam Pillai
2006-11-07 15:20:44 UTC
Permalink
Use:

If ActiveWindow.Selection.HasChildShapeRange Then
Debug.Print ActiveWindow.Selection.ChildShapeRange(1).Name
End If
--
Regards,
Shyam Pillai

Animation Carbon
http://www.animationcarbon.com
Post by Staroslav
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.
Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Staroslav
2006-11-08 11:39:01 UTC
Permalink
Shyam, thank you! So simple!
Your code made available elsewhere has been a great help to me in trying to
get a measure of control over PowerPoint.
Thank you very much again!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Post by Shyam Pillai
If ActiveWindow.Selection.HasChildShapeRange Then
Debug.Print ActiveWindow.Selection.ChildShapeRange(1).Name
End If
--
Regards,
Shyam Pillai
Animation Carbon
http://www.animationcarbon.com
Post by Staroslav
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.
Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Staroslav
2006-11-08 13:27:01 UTC
Permalink
Shyam,
Your code works only if the whole object in a group is selected. However, if
the cursor is inside that object, HasChildShapeRange condition is not met.
Why is that? And more importantly, what to do in this case? Thank you.
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Post by Shyam Pillai
If ActiveWindow.Selection.HasChildShapeRange Then
Debug.Print ActiveWindow.Selection.ChildShapeRange(1).Name
End If
--
Regards,
Shyam Pillai
Animation Carbon
http://www.animationcarbon.com
Post by Staroslav
I am trying to change color properties of a selected item in a group. Having
difficulty identifying in vba which item is selected. All the code I've seen
goes by a certain type of an item, but that is not helpful when you have 30
items of the same type and only one of then needs to be changed.
Any ideas? Thank you ahead of time!
--
+
( )
__ | __ | __
Greetings from Moscow, Russia
Steve Rindsberg
2006-11-11 04:14:48 UTC
Permalink
Post by Staroslav
Shyam,
Your code works only if the whole object in a group is selected. However, if
the cursor is inside that object, HasChildShapeRange condition is not met.
Why is that? And more importantly, what to do in this case? Thank you.
If ActiveWindow.Selection.Type = ppSelectionText Then
' the cursor is in a text frame/text is selected
Debug.Print ActiveWindow.Selection.TextRange.Parent.Parent.Name
End If

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Continue reading on narkive:
Loading...