Q:

Visio VBA Get Pasted Shapes

I have a macro which works differently between Visio 2003 and 2010.  I'm copying and pasting a shape onto the page, and trying to get a pointer to the pasted shape.  In 2003, that shape is just the last shape on the page (set ShpObj = PagObj.Shapes(PagObj.Shapes.Count)).  In 2010, however, it seems the pasted shape isn't always set to the last shape on the page.
Currently I am logging all the unique shapes on the page before the paste operation, then identifying new shapes after the paste operation.
I tried monitoring the application ShapeAdded event, but it doesn't seem to fire for paste operations.
Are there any other ways I might pick up the pasted shape(s)?

A:

How are you doing your copying?  Visio 2010 gained some more enumerations giving greater control over the paste operation in terms or position and container and callout behaviour which might effect collection order:
Visio 2010 Page.Paste
Visio 2007 Page.Paste
It's a shame Paste doesn't return a selection, but have you looked at Shape.Duplicate and Selection.Duplicate which return shape and selection objects respectively?

