OK, code to add command to tool bar written.
But still can't access the RemoveImage as an Action Setting on picture object.
How do I do this ?
Sub RemoveImage(oSh As Shape)
oSh.Delete
End Sub
Sub Auto_Open()
Dim oToolbar As CommandBar
Dim oButton As CommandBarButton
Dim MyToolbar As String
MyToolbar = "RemoveImage Tool"
On Error Resume Next
Set oToolbar = CommandBars.Add(Name:=MyToolbar,
Position:=msoBarFloating, Temporary:=True)
If Err.Number <> 0 Then
Exit Sub
End If
On Error GoTo ErrorHandler
Set oButton = oToolbar.Controls.Add(Type:=msoControlButton)
With oButton
.DescriptionText = "RemoveImage"
.Caption = "RemoveImage"
.OnAction = "RemoveImage"
.Style = msoButtonIcon
.FaceId = 52
End With
oToolbar.Top = 150
oToolbar.Left = 150
oToolbar.Visible = True
NormalExit:
Exit Sub
ErrorHandler:
MsgBox Err.Number & vbCrLf & Err.Description
Resume NormalExit:
End Sub