Search code examples
vbapowerpoint

Unique identifier for SlideMaster


While I realize that a SlideMaster has a unique name in a given presentation (though I understand this to be buggy), is there a way to uniquely identify a master that a user can't touch? Alternatively, is there an equivalent to the Slide's Tags collection, somewhere I can stash my own ID?

For PowerPoint 2003 and/or 2007... Thanks in advance.


Solution

  • I initially thought there was no good way to protect a SlideMaster name from a user, because it seems to be very easily provided via the Master view. In 2007, this is very easy to get to, as indicated above: View tab of ribbon, Slide Master button, right-click any master, and rename. Pretty much the same in 2003, View menu > Master > Slide Master, right-click the master in question in the lefthand thumbnail list, rename.

    The happy fact is that this does not rename the master but rather the design. The Ppt object model is not very straightforward when it comes to these two objects; each master is apparently the parent of a design, but for all intents and purposes, they are employed 1-to-1, and each exposes the other as a property: SlideMaster.Design (for the "active" slide master only) or Design.SlideMaster (at least as far as the slide master is concerned--I'm not working with the other three, so can't really speak to them here). When the user follows the series of steps detailed above, the equivalent vba is myDesign.Name = "SomeNewName", not mySlideMaster.Name = "SomeNewName". The master's name is unaffected; likewise, if in VBA I execute mySlideMaster.Name = "SomeNewVBAName", the corresponding Design name a user might have chosen remains intact.