A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Powerpoint, Publisher and Visio » Powerpoint
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

UniqueID for shape



 
 
Thread Tools Display Modes
  #1  
Old August 21st, 2004, 02:49 AM
Lenonardo
external usenet poster
 
Posts: n/a
Default UniqueID for shape

Is there a way to associate a unique id with a shape.

I want to update a PPT presentation containing slides I have created from a
program.
The presentation will be edited interactively in between creating the
slides and updating them.

I want to make sure that if someone copies one of my shapes, adn deletes my
original, that I do NOT update the copy (and can detect that the original
is gone.)

Best I have managed to com up with so far is SlideID + shape index,
but I'm not sure if this is unique, or if there is something better.

Any help appreciated.
  #2  
Old August 21st, 2004, 03:25 AM
David M. Marcovitz
external usenet poster
 
Posts: n/a
Default

Why don't you give the shape a name. I don not believe that shape names are
copied when a shape is copied and pasted. There are some procedures for
naming shapes at my Web site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Look for Example 8.7 by clicking on Examples by Chapter and Chapter 8.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/


"Lenonardo" wrote:

Is there a way to associate a unique id with a shape.

I want to update a PPT presentation containing slides I have created from a
program.
The presentation will be edited interactively in between creating the
slides and updating them.

I want to make sure that if someone copies one of my shapes, adn deletes my
original, that I do NOT update the copy (and can detect that the original
is gone.)

Best I have managed to com up with so far is SlideID + shape index,
but I'm not sure if this is unique, or if there is something better.

Any help appreciated.

  #3  
Old August 21st, 2004, 04:10 AM
Shyam Pillai
external usenet poster
 
Posts: n/a
Default

David,
That won't work as expected. There is a bug with naming shapes using VBA.
Once you name a shape with VBA everytime a copy/paste operation is performed
on the shape, the shape retains the same name.

Try renaming a shape with VBA.
Copy/Paste a duplicate of the shape, check the name of the new shape.


--
Regards
Shyam Pillai

Handout Wizard: http://www.mvps.org/skp/how/


"David M. Marcovitz" wrote in
message ...
Why don't you give the shape a name. I don not believe that shape names
are
copied when a shape is copied and pasted. There are some procedures for
naming shapes at my Web site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Look for Example 8.7 by clicking on Examples by Chapter and Chapter 8.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/


"Lenonardo" wrote:

Is there a way to associate a unique id with a shape.

I want to update a PPT presentation containing slides I have created from
a
program.
The presentation will be edited interactively in between creating the
slides and updating them.

I want to make sure that if someone copies one of my shapes, adn deletes
my
original, that I do NOT update the copy (and can detect that the original
is gone.)

Best I have managed to com up with so far is SlideID + shape index,
but I'm not sure if this is unique, or if there is something better.

Any help appreciated.



  #4  
Old August 21st, 2004, 04:20 AM
Shyam Pillai
external usenet poster
 
Posts: n/a
Default

Leonardo,
The SlideID + shape index will create problems if the user changes the order
of shapes on the slide. Just use the slideID if you want to check if the
shape resides on the same slide as the stored internal indentification. But
consider what would happen it the author duplicated the slide or copied the
slide to another presentation.

If you are using PowerPoint 2002 or later, there is a read-only property -
ID - which is available. You could use this by itself or in combination with
the slide ID.

--
Regards
Shyam Pillai

Animation Carbon - http://www.mvps.org/skp/ac/index.html


"Lenonardo" wrote in message
...
Is there a way to associate a unique id with a shape.

I want to update a PPT presentation containing slides I have created from
a
program.
The presentation will be edited interactively in between creating the
slides and updating them.

I want to make sure that if someone copies one of my shapes, adn deletes
my
original, that I do NOT update the copy (and can detect that the original
is gone.)

Best I have managed to com up with so far is SlideID + shape index,
but I'm not sure if this is unique, or if there is something better.

Any help appreciated.




  #5  
Old August 21st, 2004, 12:22 PM
Lenonardo
external usenet poster
 
Posts: n/a
Default

"Shyam Pillai" wrote in
:

Leonardo,
The SlideID + shape index will create problems if the user changes the
order of shapes on the slide. Just use the slideID if you want to
check if the shape resides on the same slide as the stored internal
indentification. But consider what would happen it the author
duplicated the slide or copied the slide to another presentation.

If you are using PowerPoint 2002 or later, there is a read-only
property - ID - which is available. You could use this by itself or in
combination with the slide ID.


I had a search for all obvious 'unique name' properties - but didn't
find ID. I'll have another look.
  #6  
Old August 21st, 2004, 12:23 PM
Lenonardo
external usenet poster
 
Posts: n/a
Default

=?Utf-8?B?RGF2aWQgTS4gTWFyY292aXR6?=
wrote in
:

Why don't you give the shape a name. I don not believe that shape
names are copied when a shape is copied and pasted. There are some
procedures for naming shapes at my Web site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Look for Example 8.7 by clicking on Examples by Chapter and Chapter 8.

--David

David M. Marcovitz
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/


"Lenonardo" wrote:

Is there a way to associate a unique id with a shape.

I want to update a PPT presentation containing slides I have created
from a program.
The presentation will be edited interactively in between creating the
slides and updating them.

I want to make sure that if someone copies one of my shapes, adn
deletes my original, that I do NOT update the copy (and can detect
that the original is gone.)

Best I have managed to com up with so far is SlideID + shape index,
but I'm not sure if this is unique, or if there is something better.

Any help appreciated.



Copying shapes within the same slide will assign new automatically
generated names. But if you assing a name yourself - it gets copied.
If you copy shapes between slides then slightly different behaviour
occurs.

So it is possible that using the automatically generaed names may give
uniqueness within a slide. But probably not across slides.

I would suspect that all writeable properties get copied.
SO I am looking for a read-only application generated ID.
  #7  
Old August 21st, 2004, 02:10 PM
Lenonardo
external usenet poster
 
Posts: n/a
Default

"Shyam Pillai" wrote in
:

Leonardo,
The SlideID + shape index will create problems if the user changes the
order of shapes on the slide. Just use the slideID if you want to
check if the shape resides on the same slide as the stored internal
indentification. But consider what would happen it the author
duplicated the slide or copied the slide to another presentation.

If you are using PowerPoint 2002 or later, there is a read-only
property - ID - which is available. You could use this by itself or in
combination with the slide ID.


Looks like ID will do what I require for PPT 2002+.

But I think adding PLACEHOLDERS will do everything I want (which I can
use as I am creating the slides) and across all likely version of PPT (I
hope).

  #8  
Old August 21st, 2004, 04:58 PM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default

In article , Lenonardo wrote:
Is there a way to associate a unique id with a shape.


Hmmm. As Shyam's pointed out, naming it won't help.

But as it's created, each shape is assigned an ID which will be unique, as far
as I can tell (unlike the shape .Name)

You could do something along these lines:

' Tag the shape with its own ID to identify it as one of yours
Sub TagTheShape()
With ActiveWindow.Selection.ShapeRange(1)
Call .Tags.Add("MySecretID",Cstr(.ID))
End With
End Sub

Then later when you need to test if it's an original:

Sub IsItMine()
With ActiveWindow.Selection.ShapeRange(1)
If .Tags("MySecretID") = Cstr(.Id) Then
Msgbox ("It's MINE")
End If
End With
End Sub

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

  #9  
Old August 23rd, 2004, 01:16 PM
Lenonardo
external usenet poster
 
Posts: n/a
Default

Steve Rindsberg wrote in
:

In article , Lenonardo wrote:
Is there a way to associate a unique id with a shape.


Hmmm. As Shyam's pointed out, naming it won't help.

But as it's created, each shape is assigned an ID which will be
unique, as far as I can tell (unlike the shape .Name)

You could do something along these lines:

' Tag the shape with its own ID to identify it as one of yours
Sub TagTheShape()
With ActiveWindow.Selection.ShapeRange(1)
Call .Tags.Add("MySecretID",Cstr(.ID))
End With
End Sub

Then later when you need to test if it's an original:

Sub IsItMine()
With ActiveWindow.Selection.ShapeRange(1)
If .Tags("MySecretID") = Cstr(.Id) Then
Msgbox ("It's MINE")
End If
End With
End Sub

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
=============================================== =
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
=============================================== =


Thanks Steve.

I think the ID property is only for Powerpoint 2002+ and I need this to
work on Powerpoint 2000.

If ID is available then I will be storing the IDs of the charts I
create, so don't need to test them in the presentation - I will just
look for my saved Shape IDs.

With shape names - if you use the default names then these DO get
changed when copying onto the same slide. Not sure when / if this is the
case when copying onto other Slides.

So - I have considered using your secret tag approach to save tags for
parent_slide_id and shape_auto_name. Then I can test these against their
actual values, and if they match then this is my shape (probably).

I am also looking at PlaceHolders - as it looks like these are set when
the slide is created and cannot be altered afterwards. So - if I can
stick my chart into a placeholder then I should be able to uniquely
identify it using a matching set of secret tags.

But I'm not entirely clear if placeholders behave as I expect them to.
The MS documentation seems clear - but is frequently contradicted in
examples and other manuals I have found. Maybe these are just loose uses
of the term placeholder.

The MS VBAPP10.chm file clearly states that:

"You can delete individual placeholders by using the Delete method, and
you can restore deleted placeholders by using the AddPlaceholder method,
but you cannot add any more placeholders to a slide than it had when it
was created."
  #10  
Old August 23rd, 2004, 05:17 PM
Steve Rindsberg
external usenet poster
 
Posts: n/a
Default


I think the ID property is only for Powerpoint 2002+ and I need this to
work on Powerpoint 2000.


Nuts. You're right.

But I'm not entirely clear if placeholders behave as I expect them to.
The MS documentation seems clear - but is frequently contradicted in
examples and other manuals I have found. Maybe these are just loose uses
of the term placeholder.

The MS VBAPP10.chm file clearly states that:

"You can delete individual placeholders by using the Delete method, and
you can restore deleted placeholders by using the AddPlaceholder method,
but you cannot add any more placeholders to a slide than it had when it
was created."


That's correct. MS defines the placeholders (number and type) per layout. You
can remove or restore the predefined placeholders but not create your own.

Does that make it clearer?

--
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
Featured Presenter, PowerPoint Live 2004
October 10-13, San Diego, CA www.PowerPointLive.com
================================================

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:23 PM.


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