Which text link called a macro?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I've used the Action Settings to set up a number of text links in a
presentation to call one macro - Macro5 in this case - for use in slideshow
mode.

Inside the macro, I want to reference the text of the calling link. I link
"Foo" to macro macro5 and "bar" to macro5. When I click Foo during the
slideshow, I want Macro5 to determine that "Foo" called it. Same for "Bar".
In real life, the link text will be file names and I'll do various things
with the files. For now, I can't figure out how to determine which link
called the macro.

Suggestions?

Thanks,
Ed
 
Sorry about the double post. I didn't delete the first as quickly as I
should have.

There isn't an obvious way to pass a parameter via Action Settings. Also,
I'm hoping to do action settings for many bits of text at a time. Setting
individual parameters would make that less practical.
 
Actually, you can pass a parameter, but I think it will only pass the
shape that was clicked, not the text. This is fine if the text is the
only text in the shape, but doesn't work so well if you have huge
paragraphs with multiple bits of text with action settings. Look at
Example 8.10 on my site:

http://www.PowerfulPowerPoint.com/

Click on "Examples by Chapter" and "Chapter 8" to find it.

--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
Amazing! I copied your macro, named it macro5 (hey, I'm lazy), called it and
it worked!

You cannot imagine how much time you have just saved me.

Oh, the macro in question:

Sub macro5(answerbutton As Shape)
Dim theAnswer As String
theAnswer = answerbutton.TextFrame.TextRange.Text
MsgBox ("You chose " & theAnswer)
End Sub

I'll fluff it up a bit from here.

Thank you!

Ed
 
Great. I'm glad it worked for you. And thanks for getting back to us to
let us know.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
One small note.

This all works when the text links are in table cells. I haven't tried any
other arrangement. By chance, that's how I had set up my slides, so I got
lucky.

The text that's passed to the macro includes all the text in the relevant
table cell. So, when I had the text "foo" in the cell, the macro got "foo".
On the slide where I had "1st: foo" and "2nd: bar" in adjacent cells, the
macro got "1st: foo" even though "foo" was the only link text. All in all,
a problem I could cope with.

Thanks again,
Ed
 
Back
Top