so here is the solution:
Private Sub Document_open()
Dim DocTest As String
On Error Resume Next
DocTest = ActiveDocument.Tables(1).Cell(1, 1).Range.Text
DocTest = Left(DocTest, Len(DocTest) - 2)
If Not DocTest = "Subject" Then
Dim doc As Word.Document
Set doc = ActiveDocument
With doc.Content.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1").ConvertToShape.OLEFormat.Object
.AutoSize = False
.Caption = "Save & Close"
.Enabled = True
.Font.Underline = False
.Font.Size = 11
.Height = 24
.Left = 500
.Locked = False
.TakeFocusOnClick = True
.Top = 25
.Width = 72
End With
On Error Resume Next
For Each o In ActiveDocument.Shapes
If Not o.OLEFormat.Object.Name = "CommandButton1" Then
o.Delete
End If
Next
End If
If DocTest = "Subject" Then
On Error Resume Next
For Each o In ActiveDocument.Shapes
If o.OLEFormat.Object.Name = "CommandButton1" Then
o.Delete
End If
Next
End If
End Sub
Thanks
Bookmarks