I just got Office 2007 Beta 2 and I have a Word template that I want to use. As expected, the custom toolbars from this template appear inside of the Add-Ins
ribbon. All of the macros work fine except for one. This macro allows the user to customize on the spot by adding a button to one of these custom
toolbars. (There is another macro that allows the user to remove the same button.) In earlier versions of Word this macro will name the button with the
exact name of the style that the user enters. This does not happen in Word 2007 however. Eventhough the added buttons function correctly and are placed inside the ribbon where you would expect, the caption is wrong; it always appears as “Apply Style Name.”
Can this be fixed in Word 2007?
Thanks, Jerry
Here is the macro that adds a button:
Sub AddButton()
Dim eName As String
eName = InputBox(“Enter the exact name of the element you would like to add as a button.”, “Adding Element Button”, “text”)
Set newbutton = CommandBars(“Basic Elements”).Controls.Add(Type:=msoControlButton, ID:=2321, Parameter:=eName)
newbutton.Caption = eName
nReply = InputBox(“Would you like to add another element button? (y or n)?”, “Add Another Button?”, “n”)
‘Add another button loop
Do Until nReply = “n”
eName = InputBox(“Enter the exact name of the element you would like to add as a button.”, “Adding Element Button”, “text”)
Set newbutton = CommandBars(“Basic Elements”).Controls.Add(Type:=msoControlButton, ID:=2321, Parameter:=eName)
newbutton.Caption = eName
nReply = InputBox(“Would you like to add another element button? (y or n)?”, “Add Another Button?”, “n”)
Loop
End Sub