Sample Code for Writing Macros
This example shows how to use the calls provided with XL Plus. To use the code in Excel, create a button, then copy and paste the example code. The steps are:
- Install XL Plus and open Microsoft Excel.
- Enable the Developer tab in Excel.
- From the Developer tab, use the Insert form control option to define your button, and select the location on the worksheet.
- Type in a name for the button and then click New to open the definition window. Copy and paste the code below in to the Assign Macro window.
- Click New to create the button.
Refer to the Microsoft help for instructions if needed.
Example: Refresh a report using its ID
Certinia Reports
To refresh a report by using its ID, create a button and copy this code snippet:
Sub Button1_Click()
'In the below line the ReportId is the ID of the report that we need to specify to refresh the report
Dim ReportId As String: ReportId = "ReportId"
Set automationObject = GetAutomationObject
Call automationObject.ImportFinancialForceReportById(ReportId)
End Sub
'Function to get the automation object
Private Function GetAutomationObject() As Object
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("FinancialForce.FinancialForceXL")
Set GetAutomationObject = addIn.Object
End Function
Salesforce Reports
To refresh a report by using its ID, create a button and copy this code snippet:
Sub Button1_Click()
'In the below line the ReportId is the ID of the report that we need to specify to refresh the report
Dim ReportId As String: ReportId = "ReportId"
Set automationObject = GetAutomationObject
Call automationObject.ImportSalesforceReportById(ReportId)
End Sub
'Function to get the automation object
Private Function GetAutomationObject() As Object
Dim addIn As COMAddIn
Dim automationObject As Object
Set addIn = Application.COMAddIns("FinancialForce.FinancialForceXL")
Set GetAutomationObject = addIn.Object
End Function