On undo ShapeRange.Textframe generates COM Exception

  • Thread starter Thread starter doodleM
  • Start date Start date
D

doodleM

Problem faced in Powerpoint 2007

1) I have a Shape in my current slide with some paragraphs
2) Creates a newShape as Duplicate of my Orginal Shape
(newShape=orgShape.Duplicate) and Set the top, left of newShape as orgShape
with some manipulation to the newShape's paragraphs.
3) Deletes the orgShape

newShape is viewed to user on powerpoint window

4) Do the Undo through (ctrl+z) or undo button on ribbon, orgShape is
visible to user on window through undo stack

5) Now my problem arises here, when I again try to do this entire steps from
1-3 or mainly tries to read orgShape.TextFrame it gives me COM Exception
thus, not able to read the orgShape.TextFrame.TextRange (paragraphs) after
this undo event happened.

No idea why it behaves like this, kindly suggest. Any pointers will be
appreciated.

Thanks
doodle
 
I suspect you are not reinitializing the orgShape variable to the shape that
has been put back by the Undo operation. The orgShape variable stops holding
a valid reference as soon as you delete that shape. You need to set it
again.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 
Back
Top