The following code listing illustrates how to insert an XBRL report into an Excel file and populate the first cell, using VBA.
' VBA Example 1: ' Creates a new EBA COREP ALM report with form 'C 68.00.a' and sets the value of the first cell Sub Example1() Dim addIn As COMAddIn Dim automationObject As Object Dim Workbook As Object Dim tableTree As Object Dim tableNode As Object ' Get the Automation API object Set addIn = Application.COMAddIns.Item("Altova.EBAAddIn") Set automationObject = addIn.Object ' Insert a new EBA 2.9.1 COREP ALM report Set Workbook = automationObject.InsertNewReport("http://www.eba.europa.eu/eu/fr/xbrl/crr/fws/corep/cir-680-2014/2019-11-15/mod/corep_alm_con.xsd") Set tableTree = automationObject.GetTableTree(Workbook) ' Find table tree node for form 'C 68.00.a' Set tableNode = tableTree.FindTableByRCCode("C 68.00.a") ' Include this table in the filing (this will also create the respective Excel worksheet) tableNode.IncludeInFiling = True ' Get the Data range of this form and set the value of the first cell to 42 tableNode.Forms.Item(0).DataRange.Item(1).Value = "42" End Sub |