Adding Built-in Buttons

  • Thread starter Thread starter Ivan
  • Start date Start date
I

Ivan

I'm trying to add built-in buttons using the following code. When X
is 120 it adds the "Align Text Left" built-in button just fine.
However when x is 4171 ("Bullets" button) I get run-time error
'-2147467259 (80004005)': Method 'Add' of object 'CommandBarControls'
failed. This happens with other built-in buttons as well.

Uh...duh...I can't figger it out! Any help will be rewarded with
sincere gratitude.

Sub AddBuiltInButton()
Dim myButt As CommandBarButton
Dim x As Integer
x = 4171 'The button Id for builtin buttons
Set myButt = Application.CommandBars("Standard").Controls.Add(1,
x)
myButt.BuiltInFace = True
End Sub
 
Ivan,
I was unable to locate the button with ID 4171. What is the language version of PowerPoint you are using.

Regards
Shyam Pillai

http://www.mvps.org/skp

----- Ivan wrote: -----

I'm trying to add built-in buttons using the following code. When X
is 120 it adds the "Align Text Left" built-in button just fine.
However when x is 4171 ("Bullets" button) I get run-time error
'-2147467259 (80004005)': Method 'Add' of object 'CommandBarControls'
failed. This happens with other built-in buttons as well.

Uh...duh...I can't figger it out! Any help will be rewarded with
sincere gratitude.

Sub AddBuiltInButton()
Dim myButt As CommandBarButton
Dim x As Integer
x = 4171 'The button Id for builtin buttons
Set myButt = Application.CommandBars("Standard").Controls.Add(1,
x)
myButt.BuiltInFace = True
End Sub
 
Thank you Shyam. It's PPT 2000 SP-3 US English. I have the proofkit
for several other languages. What button ID do you get returned for
"Bullets"? If the button ID 4171 is really bogus, perhaps another way
around it would be to get the list of "real" button ids... Ever hear
of such a thing?
 
[CRITICAL UPDATE - Anyone using Office 2003 should install the critical
update as soon as possible. From PowerPoint, choose "Help -> Check for
Updates".]

Hello,

If you (or anyone else reading this message) have any suggestions on how
PowerPoint might make it easier to perform this programming task, don't
forget to send your feedback (in YOUR OWN WORDS, please) to Microsoft at:

http://register.microsoft.com/mswish/suggestion.asp

As with all product suggestions, it's important that you not just state
your wish but also WHY it is important to you that your product suggestion
be implemented by Microsoft. Microsoft receives thousands of product
suggestions every day and we read each one but, in any given product
development cycle, there are only sufficient resources to address the ones
that are most important to our customers so take the extra time to state
your case as clearly and completely as possible.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions)

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
Back
Top