none
SlideThemesGallery no working with Application.CommandBars.ExecuteMso( RRS feed

  • Question

  • Hi ,

    In my VSTO ribbon (PowerPoint) im try to show SlideThemesGallery   by custom button

    code as follows

     Globals.ThisAddIn.Application.CommandBars.ExecuteMso("SlideOrientationGallery");

    its giving me a error "value does not fall with in expected range."

    my PowerPoint version is 2013 stranded

    can any one help me on this

    Tuesday, June 25, 2013 8:24 AM

Answers

  • Hi gayan

    CommandBars.ExecuteMso is a good way to have an Office application execute a single command in its default mode. The problem is, it must be a command. A Gallery (as well as a combobox or a menu) provides a selection of items. There's no way to communicate which item you'd want to have executed. That's why ExecuteMso doesn't work for you, in this case and you'd have to use an approach such as Quist suggests.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 27, 2013 2:14 PM
    Moderator
  • Hi Gayan_gagb,

    Thank you for posting in the MSDN Forum.

    As far as I'm concerned, you cannot do that to show the gallery.

    ExecuteMso method won't take SlideOrientationGallery as a valid parameter. The CommandBars is a concept existed in older version Office application.

    The use of it in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface.

    Apart from the above, in a program/solution we usually make changes by calling methods or assigning to certain properties directly rather than simulate human's operation.

    So, in order to change the theme of a presentation, you can directly call Presentation.ApplyTheme Method rather than expand the gallery and choose one among all the themes.

    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, June 26, 2013 11:13 AM
    Moderator

All replies

  • Hi Gayan_gagb,

    Thank you for posting in the MSDN Forum.

    As far as I'm concerned, you cannot do that to show the gallery.

    ExecuteMso method won't take SlideOrientationGallery as a valid parameter. The CommandBars is a concept existed in older version Office application.

    The use of it in some Microsoft Office applications has been superseded by the new ribbon component of the Microsoft Office Fluent user interface.

    Apart from the above, in a program/solution we usually make changes by calling methods or assigning to certain properties directly rather than simulate human's operation.

    So, in order to change the theme of a presentation, you can directly call Presentation.ApplyTheme Method rather than expand the gallery and choose one among all the themes.

    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, June 26, 2013 11:13 AM
    Moderator
  • Hi gayan

    CommandBars.ExecuteMso is a good way to have an Office application execute a single command in its default mode. The problem is, it must be a command. A Gallery (as well as a combobox or a menu) provides a selection of items. There's no way to communicate which item you'd want to have executed. That's why ExecuteMso doesn't work for you, in this case and you'd have to use an approach such as Quist suggests.


    Cindy Meister, VSTO/Word MVP, my blog

    Thursday, June 27, 2013 2:14 PM
    Moderator