CreateJournal

Description

CreateJournal() creates a blank journal or a journal based on a Standard or Recurring template.

Syntax

Function CreateJournal(

dims() As String,

dimVals () As String,

templateType As String,

templateNames() As String

) As Long

Parameters

dims: An input argument. Provide the list of dimensions as an array of strings.

dimVals: An input argument. Provide the list of dimension values as an array of strings.

templateType: An input argument. Value is one of the following:

  • HFM_JOURNAL_TEMPLATE_TYPE_BLANK

  • HFM_JOURNAL_TEMPLATE_TYPE_STANDARD

  • HFM_JOURNAL_TEMPLATE_TYPE_RECURRING

These are defined in HFMJournalVBA.bas.

templateNames: An input argument. Provide the template names as an array of strings.

Return Value

Returns 0 if successful; otherwise, returns the appropriate error code.

Example

Sub CreateJournal
‘Connect to an HFM data source
HypConnect “Sheet1”, “admin”, “password”, “connName”

Set jObj = New JournalVBA
jObj.UseActiveConnectionContext

dims(0) = HFM_JOURNAL_DIM_SCENARIO
dims(1) = HFM_JOURNAL_DIM_YEAR
        dims(2) = HFM_JOURNAL_DIM_PERIOD
        dims(3) = HFM_JOURNAL_DIM_VALUE
    
        dimVals(0) = "Actual"
        dimVals(1) = "2007"
        dimVals(2) = "January"
dimVals(3) = "<Entity Curr Adjs>"

        Dim templateNames(0) As String
        templateNames(0) = "Template1"
retVal = jObj.CreateJournal(dims, dimVals, HFM_JOURNAL_TEMPLATE_TYPE_STANDARD, templateNames)
    
        If retVal = 0 Then
        Debug.Print "Create Journal from Template Succeeded"
        Else
        Debug.Print "Create Journal from Template Failed!!!"
        End If
End Sub