1

I am trying to build a macro that allows the user to select a few ojbects in PowerPoint, name that selection, then at a later stage pick a name to reselect those objects.

I am stuck at saving the current selection as a variable, and saving that variable as part of the PPT, so that when a user opens the file again those selections are still availible.

I've tried declaring a variable of the Selection type, and setting its value to the active selection. But this gives an error.

Fr0stY
  • 21
  • 1

1 Answers1

2

You can't save a selection as such, but you can tag the selected shapes when the user opts to save the current selection, then when the user chooses to re-select that particular selection, look at each shape on the slide and if it has the appropriate tag, add it to the selection.

I have a free add-in that does pretty much what you're after: https://pptools.com/free/FAQ00003-Selection-Manager.htm

Steve Rindsberg
  • 14,442
  • 1
  • 29
  • 34
  • Thank you for the tip. I will give it a bash. I have your free add-in already, but I am trying to do it myself (for educational purposed). – Fr0stY Oct 31 '22 at 20:19
  • PS. Can a shape have multiple tags assigned to it? – Fr0stY Nov 01 '22 at 06:50
  • >> but I am trying to do it myself (for educational purposed) Good for you! For some of us (definitely for me) the best way to learn is to create something we'll be able to put to real use when it's done. And yes, a shape can have as many tags as you like. Slide and Presentation objects can have tags as well, by the way. A long time ago (in PowerPoint 97) I tested with a few routines that added a million tags of a few bytes each in one case and several tags of a megabyte each in another. It all worked, though the latter was faster to open. – Steve Rindsberg Nov 01 '22 at 15:59
  • 1
    I got it to work. Thanks for the help. Updating the listbox to show the availible tags on each slide, as per your add-in, turned out to be the most challenging part. The whole event trapping thing is quite tricky. – Fr0stY Nov 04 '22 at 06:06