PowerPoint VBA - Get Application object from CommandBar

?

.

Hello,

This applies to Office 2003.

I'm quite new to VBA PowerPoint and I try to leverage my VBA knowledge
acquired from Excel, Access, Word

Result from test1 for Excel => Standard /// Microsoft Excel
Result from test1 for Access => Invalid Procedure Call as "Standard" doesn't
exist in Access
Result from test1 for Word => Standard /// Microsoft Word
Result from test1 for PowerPoint => Method 'Application' of object
'CommandBar' failed

Sub test1()
Debug.Print Application.CommandBars("Standard").Name & " /// " &
Application.CommandBars("Standard").Application.Name
End Sub

Result from test2 for Excel => Invalid Procedure Call as "Menu Bar" doesn't
exist in Excel
Result from test2 for Access => Menu Bar /// Microsoft Access
Result from test2 for Word => Menu Bar /// Microsoft Word
Result from test2 for PowerPoint => Method 'Application' of object
'CommandBar' failed

Sub test2()
Debug.Print Application.CommandBars("Menu Bar").Name & " /// " &
Application.CommandBars("Menu Bar").Application.Name
End Sub

Both Application.CommandBars("Standard") and Application.CommandBars("Menu
Bar") exist in PowerPoint BUT PowerPoint doesn't seem to implement
Application method !!!

In Object Browser,"Microsoft Office 11.0 Object Library" beeing checked,
Application appears to be a valid method for CommandBar. Does PowerPoint
override standard Application method from CommandBar ? Why ?

Do you know any workaround to this bug (I call it a bug or a
misspecification) ?

I really appreciate any help on this. Thanks

Eric
 
C

Chirag

As such you should never use the names (like "Standard") of command bars and
menus. They have IDs and CommandBars object has a FindControl() that allows
you to find a command bar object by its ID. Using IDs makes your code usable
in non-English locales as well.

- Chirag

PowerShow - View multiple PowerPoint slide shows simultaneously
http://officeone.mvps.org/powershow/powershow.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top