none
COMException -- ActionSetting (unknown member) : Invalid request (PowerPoint 2010 and 2013) RRS feed

  • Question

  • I'm trying to run a macro on a Shape mouse-over event, however I'm getting the error:
    COMException -- ActionSetting (unknown member) : Invalid request


    The error occurs on this line: 

    .Action = PowerPoint.PpActionType.ppActionRunMacro 


    I'm getting the error on this code, both in PowerPoint 2010 and 2013: 

    Private Sub AdxRibbonButton1_OnClick(sender As Object, control As IRibbonControl, pressed As Boolean) Handles AdxRibbonButton1.OnClick 
     
        If PowerPointApp.Presentations.Count > 0 Then 
            Dim thisPresentation As PowerPoint.Presentation = PowerPointApp.ActivePresentation 
     
            If Not thisPresentation Is Nothing Then 
                Dim thisSlide As PowerPoint.Slide = PowerPointApp.ActiveWindow.Selection.SlideRange(1) 
     
                If Not thisSlide Is Nothing Then 
                    Dim newShape As PowerPoint.Shape = thisSlide.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShape10pointStar, 100, 100, 100, 100) 
     
                    With newShape.ActionSettings(PowerPoint.PpMouseActivation.ppMouseOver) 
                        .Action = PowerPoint.PpActionType.ppActionRunMacro 
                        .Run = "DisplayMessage" 
                    End With 
     
                End If 

            End If 
        End If 
    End Sub 
    Monday, February 25, 2013 5:49 PM

Answers

  • Hi Bernard,

    Thank you for your last reply.

    As mentioned by Andrei Smolin on the other post of yours,

    This occurs if there're no macros in the presentation. Just add a macro, even an
    empty one, and your code will work.

    After I've add a subroutine named DisplayMessage, click on the ribbon button won't lead to any error.

    Thanks to Andrei, and hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 27, 2013 2:39 AM
    Moderator

All replies

  • Hi Bernard,

    Thank you for posting in the MSDN Forum.

    I want to know your request more clear.

    I've picked out the below code and tested, but it works fine on both PowerPoint 2010 and PowerPoint 2013.

    Dim newShape As PowerPoint.Shape = thisSlide.Shapes.AddShape(Microsoft.Office.Core.MsoAutoShapeType.msoShape10pointStar, 100, 100, 100, 100) 
     
                    With newShape.ActionSettings(PowerPoint.PpMouseActivation.ppMouseOver) 
                        .Action = PowerPoint.PpActionType.ppActionRunMacro 
                        .Run = "DisplayMessage" 
                    End With 
      

    The error might be caused by outer parts of the code rather than the snippet I've picked out above.

    Hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, February 26, 2013 10:34 AM
    Moderator
  • I appreciate your response, however it's still not working. Because it's a blank add-in, with just one ribbon button, I would rule out the option that this is caused by something else.

    I could be wrong, though, so here's the blank Visual Studio 2012 project files with the function I was talking about:
    https://www.box.com/s/k38qptxs9ul1m1cvmpx0

    Tested on: Windows 8, 64-bit, with 32-bit PowerPoint 2010 and 2013

    Tested on: Windows 7, 32-bit, with 32-bit PowerPoint 2010

    Tuesday, February 26, 2013 2:36 PM
  • Hi Bernard,

    Thank you for your last reply.

    As mentioned by Andrei Smolin on the other post of yours,

    This occurs if there're no macros in the presentation. Just add a macro, even an
    empty one, and your code will work.

    After I've add a subroutine named DisplayMessage, click on the ribbon button won't lead to any error.

    Thanks to Andrei, and hope it helps.

    Best regards,


    Quist Zhang [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, February 27, 2013 2:39 AM
    Moderator