Reputation: 65
I am building an array in VBA for Powerpoint.
The sub sweeps through all shapes in each slide in the presentation, and I want to store into the array:
I will then load this array into a list box. When the user clicks on the selected item in the list box I want the property to be set with the value.
In code it would be something like this:
Dim s_MyProperty as string
Dim s_Value as string
'Remember the variables
s_MyProperty = ".PageSetup.SlideHeight"
s_Value = ActivePresentation.PageSetup.SlideHeight
' This is the part I need help with
' Apply the property
Dim o_Object as object ' or something similar
o_Object = ActivePresentation
o_Object & s_MyProperty = s_Value
The code would be similar in Excel.
Any ideas?
Upvotes: 2
Views: 5934
Reputation: 6476
check out the CallByName
function... its an oldie but a goodie.
CallbyName o_Object, s_MyProperty, VbLet, s_Value
Upvotes: 4