copy and paste a shape and get the id of the new shape

Started by matthew, October 29, 2020, 05:47:59 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

matthew

Hi,
I'm trying to copy and paste a shape and then get the id of the new shape. I was using this code:
    ActiveWindow.Select Application.ActiveWindow.Page.Shapes.ItemFromID(1245), visSelect
    Application.ActiveWindow.Selection.Copy
    Application.ActiveWindow.Page.Paste
    shpid = Application.ActiveWindow.Selection(1).ID
which used to work but now that I've made some changes on how the app works (the app has 2 files open when I run this code) I'm getting a 'selection invalid' run time error on the last line.
The object is still copied and pasted as expected its just that the line 'shpid = Application.ActiveWindow.Selection(1).ID' doesn't work now.
Where am I going wrong?
many thanks
Matthew


matthew

Managed to work it out, just needed to be more specific with the document I was working with!