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
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