Fr0stY
Fr0stY

Reputation: 21

How do I save selected objects as a variable and recall that selection in PowerPoint using VBA?

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.

Upvotes: 1

Views: 116

Answers (1)

Steve Rindsberg
Steve Rindsberg

Reputation: 14809

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

Upvotes: 2

Related Questions