Public Type WSheets
WName As String
hVal As String
hName As String
hWgt As String
hDate As String
colHeadings() As String
colVal As Integer
colName As Integer
colWgt As Integer
colDate As Integer
LastCol As Integer
LastRow As Integer
SortOrder() As String
NumericCols() As String
End Type
Function PropertiesOf(aType As WSheets, Optional index As Variant) As Variant
Dim Result() As Variant
Dim temp As Variant, i As Long
ReDim Result(1 To 14)
With aType
Result(1) = .WName
Result(2) = .hVal
Result(3) = .hName
Result(4) = .hWgt
Result(5) = .hDate
On Error GoTo InitializeColHeadings
ReDim temp(LBound(.colHeadings) To UBound(.colHeadings))
On Error GoTo 0
For i = LBound(.colHeadings) To UBound(.colHeadings)
temp(i) = .colHeadings(i)
Next i
Result(6) = temp
'...
On Error GoTo InitializeNumericCols
ReDim temp(LBound(.colHeadings) To UBound(.colHeadings))
On Error GoTo 0
For i = LBound(.NumericCols) To UBound(.NumericCols)
temp(i) = .NumericCols(i)
Next i
Result(14) = temp
If IsMissing(index) Then
PropertiesOf = Result
Else
Select Case TypeName(index)
Case "Integer", "Long", "Double", "Single", "Byte"
PropertiesOf = Result(index)
Case "String"
Select Case LCase(index)
Case "wname": PropertiesOf = Result(1)
Case "hval": PropertiesOf = Result(2)
Case "hname": PropertiesOf = Result(3)
' ...
End Select
End Select
End If
End With
Exit Function
InitializeColHeadings:
ReDim aType.colHeadings(-1 To -1)
Resume
'...
InitializeNumericCols:
ReDim aType.NumericCols(-1 To -1)
Resume
End Function