I'm using VBA in PowerPoint and have over 50 shapes on a slide, all of which are named. To update the color of the shape, I reference a slide later in the presentation. The slide numbers are stored as global variables and assigned in a sub (slide nums stay constant):
Sub getSlideNum()
example1_SlideNum = 25
example2_SlideNum = 26
example3_SlideNum = 27
etc.
End Sub
Based off the shapes name, I'm able to use "example1", "example2", "example3", etc. I then concatenate it with "_SlideNum" giving me the variable name.
Instead of using If Statements or a Select Case to assign each variable their slide, I want to have a short function like so:
Function getSlide(shpName As String)
Call getSlideNum 'get the slide num for each from the previously mentioned sub
Dim p As Variant
p = shpName & "_SlideNum"
getSlide = p
End Function
As expected, getSlide returns the string example1_SlideNum and NOT 25.
Is there a way to convert the string into the variable so it uses the stored value rather than the string text?
It would be nice to have a short function like above instead of typing up 50 or so Select Case statements.

Scripting.Dictionarywould be a good choice.