
Here is an example of an extension added to the Ribbon: adding a shortcut to the sheet option “Use as Input Form” directly in the ribbon.
<EPMTab xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xml.sap.com/2010/02/bpc"> <Group> <label>Sheet Options</label> <Component> <type>ToggleButton</type> <label>Use as Input Form</label> <supertip>This toggle button is a shortcut to the sheet option "Use as Input Form"</supertip> <keytip></keytip> <onAction>MyMacroFile.xla!SetInputForm</onAction> <isEnabled>MyMacroFile.xla!IsEPMWorksheet</isEnabled> <onPressed>MyMacroFile.xla!IsSheetInputable</onPressed> </Component> </Group> </EPMTab>
Public api As Object
Public cofCom As Object
Sub SetInputForm()
' Retrieve the current status of the sheet option "Use as Input Form"
state = api.GetSheetOption(ActiveSheet, 1)
' Set the status to the opposite
api.SetSheetOption ActiveSheet, 1, Not state
End Sub
Function IsEPMWorksheet()
' Check if the API is correctly loaded
If api Is Nothing Then
Set cofCom = Application.COMAddIns("SapExcelAddIn").Object
Set api = cofCom.GetPlugin("com.sap.epm.FPMXLClient")
End If
' Check if the current sheet is an EPM Worksheet
IsEPMWorksheet = Not api.GetSheetOption(ActiveSheet, 4)
End Function
Function IsSheetInputable()
If api Is Nothing Then
IsSheetInputable = False
Else
' Return the value of the sheet option "Use as Input Form"
IsSheetInputable = api.GetSheetOption(ActiveSheet, 1)
End If
End Function