2

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:

  1. The property (as string or object)
  2. The value of that property.

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?

1 Answer 1

4

check out the CallByName function... its an oldie but a goodie.

CallbyName o_Object, s_MyProperty, VbLet, s_Value
Sign up to request clarification or add additional context in comments.

1 Comment

Happy to help :q Thanks for the acknowledgement!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.