Hi there,
as I didn't manage to bring a toggle button (for adding/removing a shape to/from the slidemaster) to work using XML by now, I thought: Ok, create two buttons. One to add it, one to delete. I managed adding, and for deleting I tried to use John's masterpiece of code written above. But, although debugging doesn't say anything, I must have made a mistake, because it always jumps to the message box. And, once again, I'm too blind to find it ...
The code to add:
Sub Callback6(control As IRibbonControl)
Dim shp As Shape
'Draft stamp on Master
Set shp = Application.ActivePresentation.SlideMaster.Shapes.AddTextbox(msoTextOrientationHorizontal, Left:=39.118086, Top:=5.6692878, Width:=26.362188, Height:=21.826758)
With shp
.Fill.Visible = msoFalse
.Line.Visible = msoFalse
.Name = "Draftmaster"
With .TextFrame
.TextRange.Text = "Draft"
.VerticalAnchor = msoAnchorTop
.MarginBottom = "3,685037"
.MarginLeft = "0"
.MarginRight = "0"
.MarginTop = "3,685037"
.WordWrap = msoFalse
With .TextRange
.Font.Size = 12
.Font.Name = "Arial"
.Font.Color.RGB = RGB(89, 171, 244)
.ParagraphFormat.Alignment = ppAlignLeft
End With
End With
End With
End Sub
The (obviously wrong) code to delete:
Public Sub Callback7(control As IRibbonControl)
Dim L As Long
On Error GoTo err
For L = ActivePresentation.SlideMaster.Shapes.Count To 1 Step -1
If ActivePresentation.SlideMaster.Shapes(L)("Draftmaster") = "YES" Then
ActivePresentation.SlideMaster.Shapes(L)("Draftmaster").Delete
End If
Next L
Exit Sub
err:
MsgBox "There is no draft sticker on the slidemaster"
End Sub
Does anyone see where I went wrong?
Thank you
Rob