Hi there,
I'm a big fan of toggle buttons :-)
Well, in fact, I try to create one by myself for the first time. I read the tutorial of Gregory K. Maxey and tried to do it by myself in XML and PPTX 2010 for a TextBox appearing/getting deleted from the slidemaster. XML validation says: Well formed. VBA debugging doesn't say anything. But pressing my button says: Macro not found. I have no idea what went wrong and would appreciate your help very much.
Thanks,
RG
This is what I wrote in XML:
<customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon startFromScratch="false">
<tabs>
<tab id="RGHomeTab" label="RG Home">
<group id="ToggleTest" label="Test">
<toggleButton id="customButton7" image="PH" onAction="RibbonControl.ToggleonAction" getPressed="RibbonControl.buttonPressed"/>
</group>
</tab>
</Tabs>
</ribbon>
</customUI>
My VBA code is:
Sub ToggleonAction(control As IRibbonControl, pressed As Boolean)
Select Case control.Id
Case Is = "customButton7"
If pressed Then
Dim shp As Shape
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
Else
Application.ActivePresentation.SlideMaster.Shapes(Draftmaster) = Delete
End If
End Select
End Sub
Sub buttonPressed(control As IRibbonControl, ByRef toggleState)
Select Case control.Id
Case Is = "customButton7"
If Not Application.ActivePresentation.SlideMaster.Shapes(Draftmaster) Then
toggleState = True
Else
toggleState = False
End If
End Select
End Sub