OF COURSE! THAT'S IT...(reading my last 2 posts)...If we make the procedure an Open event, any changes to the code can't be run until the document is saved and re-opened.
Copy and paste the following code into "ThisDocument", save it, exit and open...
Option Explicit
Private Sub Document_Open()
Dim intBeforeIndex As Integer
Dim cmdbar As CommandBar
Dim cmdbutton As CommandBarButton
Const strToolbar As String = "Double Vision HK VBA"
On Error Resume Next
CommandBars(strToolbar).Delete
Set cmdbar = CommandBars.Add(Name:=strToolbar, Position:=msoBarTop, Temporary:=False, MenuBar:=False)
cmdbar.Visible = True
Set cmdbar = CommandBars(strToolbar)
intBeforeIndex = 1
Set cmdbutton = cmdbar.Controls.Add(Type:=msoControlButton, Temporary:=False, Before:=intBeforeIndex)
With cmdbutton
.Style = msoButtonCaption
.OnAction = "modReplaceStringNames.ReplaceStringNames"
.Caption = "String Names"
End With
End Sub
Hopefully we can mark this solvered now