Jump to content
Sign in to follow this  

MsoCommandBar in PowerPoint

Recommended Posts

I have some add-ins for Microsoft PowerPoint. Each add-in is MsoCommandBar object. I need to click buttons on my add-ins, but I have a problem: Same CommandBar can have ID MsoCommandBar4, MsoCommandBar5, MsoCommandBar2 - and I cannot access it using controlID. Can I access this control using "text" only?

Share this post

Link to post
Share on other sites


It is possible to access a control by text as well.

see here for a short example :

Opt("WinTitleMatchMode", 4) ; Allow ClassName lookup to avoid window confusion
Opt("GUIOnEventMode", 1) ; Change to OnEvent mode
Opt("RunErrorsFatal", 0) ; Fatal errors not to crach the scripts = 0
; Opt("WinTextMatchMode", 2) ; 2 = Quick

Global $handleList = ""

While 1
    $appWindow = WinGetHandle("classname=TsShellWinClass","Drawings")

See in the help file for more info on WinGetHandle and WinTitleMatchMode

Hope this helps you going



Share this post

Link to post
Share on other sites

sorry, not ControlID - ClassNameNN changes.. One element on every start of PowerPoibt has new ClassNameNN.

I try use WinTitleMatchMode, but it works only with windows.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...