Returns the maximum number of digits to the right of the decimal point that an account supports. In other words, GetNumDecimalPlaces returns the value to which an account’s NumDecimalPlaces attribute has been set.
<HsvAccounts>.GetNumDecimalPlaces lItemID, psNumDecimalPlaces
This example inserts the labels and the number of the supported decimal places of an application’s accounts into a Microsoft Excel 97 spreadsheet. The member IDs of the accounts are obtained with IHsvTreeInfo.EnumAllMemberIDs. A two-dimensional array containing the accounts’ labels and their corresponding NumDecimalPlaces values is created, using GetNumDecimalPlaces and IHsvTreeInfo.GetLabel. This array is then inserted into Microsoft Excel.
Dim cAccounts As HsvAccounts, cTreeInfo As IHsvTreeInfo
Dim vaAcctIDs, sLabel As String, iNumDecs As Integer
Dim lHiBound As Long, vaAcctDecimals(), lRows As Long
Dim xlApp As Excel.Application, wb As Excel.Workbook
Set cAccounts = m_cMetadata.Accounts
Set cTreeInfo = m_cMetadata.Accounts
cTreeInfo.EnumAllMemberIDs vaAcctIDs
lHiBound = UBound(vaAcctIDs)
ReDim vaAcctDecimals(lHiBound, lHiBound)
For i = LBound(vaAcctIDs) To lHiBound
cAccounts.GetNumDecimalPlaces vaAcctIDs(i), iNumDecs
cTreeInfo.GetLabel vaAcctIDs(i), sLabel
vaAcctDecimals(i, 0) = sLabel
vaAcctDecimals(i, 1) = iNumDecs
Next i
'Open Excel - assumes Excel is referenced in Project>References.
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wb = xlApp.Workbooks.Add()
lRows = UBound(vaAcctDecimals)
'Loop through the arrays and put the data into Excel.
For i = 0 To lRows
xlApp.Range("A" & Trim$(Str(i + 1))).Value = _
vaAcctDecimals(i, 0)
xlApp.Range("B" & Trim$(Str(i + 1))).Value = _
vaAcctDecimals(i, 1)
Next i