Attribute VB_Name = "modMacros"
Private Macros() As MACRO_TYPE
Private Type MACRO_TYPE
    Name As String
    Content() As String
End Type

Public Function GetMacro(Name As String) As String()
On Error GoTo TheEnd:
    Dim I As Integer
    For I = 0 To UBound(Macros)
        If LCase$(Macros(I).Name) = LCase$(Name) Then
            GetMacro = Macros(I).Content
            Exit Function
        End If
    Next I
TheEnd:
    ReDim GetMacro(0)
End Function

Public Sub LoadMacros()
On Error GoTo hErr:
1   ReDim Macros(0)
    Dim FF As Integer, FM As String, LN As String, Macro As MACRO_TYPE
2   ReDim Macro.Content(0)
3   FF = FreeFile
4   FM = AppData & "Data\Other\Macros.txt"
5   Open FM For Append As #FF
    Close #FF
6   Open FM For Input As #FF
7       Do Until EOF(FF)
8       Line Input #FF, LN
            With Macro
9               If Right$(Trim$(LN), 1) = "{" Then
10                  .Name = Trim$(Split(LN, "{")(0))
11              ElseIf Left$(Trim$(LN), 1) = "}" Then
                    If LenB(.Name) Then
12                      If UBound(.Content) > 0 Or LenB(.Content(0)) > 0 Then
13                          If LenB(Macros(0).Name) = 0 Then
14                              Macros(0) = Macro
15                              .Name = vbNS
16                              ReDim .Content(0)
                            Else
17                              ReDim Preserve Macros(UBound(Macros) + 1)
18                              Macros(UBound(Macros)) = Macro
19                              .Name = vbNS
20                              ReDim .Content(0)
                            End If
                        End If
                    End If
                Else
21                  If LenB(.Name) > 0 Then
22                      If LenB(.Content(0)) > 0 Then
23                          ReDim Preserve .Content(UBound(.Content) + 1)
24                          .Content(UBound(.Content)) = LN
                        Else
25                          .Content(0) = LN
                        End If
                    End If
                End If
            End With
        Loop
    Close #FF
    Exit Sub
hErr:
    ErrorHandler Err.Number, Err.Description, Erl, "Macros", "LoadMacros"
End Sub
