How do I store a selected shape and restore selection later

I want to enter a sub with a shape selected, deselect, do some other things, then restore the original selection

No Data
  • A little more details please!

    What do you want to do between Store and Restore? Run other macros? Jump between layers / pages / documents?

    The easiest way is, to store the index of a shape in a static or global variable and select afterwards this one. But if you want to do it this way, you must not run other macros between both steps and must not delete any one.

    The most complicated but also stable way is, to write all information (Page, layer, shape) in a file where you have to take care, that the information is unique (maybe you have to give all items unique names, you also can store it's location – this depends on the entire project). Then when restoring it, you need to read the file and select step by step the items like page, layer or shape.

No Data