Easy way to hide/link slide-specific text without much VBA?

K

KR

I am creating a series of "test" slides with objects (boxes) linked to code.
Multiple Choice, True/False, Matching, etc.

What I'd like to do is be able to add any shape I want during development,
and set a property or variable in PowerPoint (not in VBE) that I can use
when the shape is clicked, to create a message box. For example, I show a
picture of a red apple, and ask the question "Is the apple red or green",
then have two shapes, one that says "red" and the other says "green". If the
user clicks on the shape that says "red" I want a message box that says:
[msgbox "The apple is red",,"Correct Answer"]

So if I were able to set the following properties in Powerpoint:

Shape1.hiddenproperty1 = "The apple is red"
Shape1.hiddenproperty2 = "Correct Answer"
and
Shape2.hiddenproperty1 = "The apple is not green"
Shape2.hiddenproperty2 = "Incorrect Answer"

then code something like:
Sub Identify(oShp As Shape)
msgbox (oShp.hiddenproperty1,,hiddenproperty2)
End Sub

then I could do all my development in Powerpoint, and not have to create a
sub (or separate msgbox statement) for every object I add...

Is there a way to do this? I can't find any way to access a shape's
properties (hidden or otherwise) other than the basic ones exposed through
the Powerpoint interface...

Many thanks,
Keith
 
D

David M. Marcovitz

What about the AlternativeText property? You can access this in the
Format AutoShape dialog box under the Web tab when you are in PowerPoint,
and you can access this with Shape1.AlternativeText. You could easily
manipulate this text to include two lines or some other special character
to separate the two parts so you can write a VBA procedure to display the
first line sometimes and the second line at other times.

An alternative is to put your text right in the object in a color that is
the same as the background so it can't be seen.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
K

KR

Alternative text seems to work- since I needed multiple fields, I used "::"
in the string to separate the two fields I needed, and ended up with the
following code- Thanks!! I will need to test it out on the internet, as this
actually will be accessed from our departmental server, and I need to make
sure there isn't lag, otherwise the user might see the correct answer each
time before having to respond ;-)

Sub MakeMessage(oShp As Shape)
MTitle = Left(oShp.AlternativeText, InStr(1, oShp.AlternativeText,
"::") - 1)
MContent = Right(oShp.AlternativeText, Len(MTitle) + 3)
MsgBox MContent, , MTitle
End Sub

David M. Marcovitz said:
What about the AlternativeText property? You can access this in the
Format AutoShape dialog box under the Web tab when you are in PowerPoint,
and you can access this with Shape1.AlternativeText. You could easily
manipulate this text to include two lines or some other special character
to separate the two parts so you can write a VBA procedure to display the
first line sometimes and the second line at other times.

An alternative is to put your text right in the object in a color that is
the same as the background so it can't be seen.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/

I am creating a series of "test" slides with objects (boxes) linked to
code. Multiple Choice, True/False, Matching, etc.

What I'd like to do is be able to add any shape I want during
development, and set a property or variable in PowerPoint (not in VBE)
that I can use when the shape is clicked, to create a message box. For
example, I show a picture of a red apple, and ask the question "Is the
apple red or green", then have two shapes, one that says "red" and the
other says "green". If the user clicks on the shape that says "red" I
want a message box that says: [msgbox "The apple is red",,"Correct
Answer"]

So if I were able to set the following properties in Powerpoint:

Shape1.hiddenproperty1 = "The apple is red"
Shape1.hiddenproperty2 = "Correct Answer"
and
Shape2.hiddenproperty1 = "The apple is not green"
Shape2.hiddenproperty2 = "Incorrect Answer"

then code something like:
Sub Identify(oShp As Shape)
msgbox (oShp.hiddenproperty1,,hiddenproperty2)
End Sub

then I could do all my development in Powerpoint, and not have to
create a sub (or separate msgbox statement) for every object I add...

Is there a way to do this? I can't find any way to access a shape's
properties (hidden or otherwise) other than the basic ones exposed
through the Powerpoint interface...

Many thanks,
Keith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top