kl kl
kl kl

Reputation: 66

ppActionRunMacro not working when converted to addin(ppam)

I want to execute a piece of code when the user clicks a rectangle(shape) in the powerpoint slideshow mode .
I added a sample code , when the shape names "timelimit" is pressed the script(macro) "correctAns" should be executed.
This is working fine when run on the pptm file but when I converted it to ppam file(addin) it is giving the following error
"Runtime error-2147188160 (80048240): ActionSetting(unknown member): Invalid request"

Sub test_action()
With ActivePresentation.Slides(1).Shapes("timelimit").ActionSettings(ppMouseClick)
    .Action = ppActionRunMacro
    .Run = "correctAns"
End With
End Sub

Sub correctAns()
    MsgBox ("correct!!!")
End Sub

I found some similar questions on different forums but couldn't get any solution. Please provide me some suggestions to solve this issue

Upvotes: 0

Views: 258

Answers (1)

Steve Rindsberg
Steve Rindsberg

Reputation: 14809

The PPAM has no slides/shapes, so you'd need to make sure that whatever presentation you're running this in has a shape on slide 1 named "timelimit". Then you'd have the problem of getting the click action to run the macro from within the PPAM.

It'd likely be a lot simpler to add this to your presentation and save it as a PPTM:

Sub correctAns()
  Msgbox "correct"
End Sub

Then assign this as the macro to run when the shape is clicked.

Upvotes: 1

Related Questions