What do you mean that a TOC has no style? Every paragraph in document has a style.
You are not putting anything in an array. Your functions returns a string value not an array.
You might try:
Code:
Sub Test()
MsgBox funGetHeadingFromStyle("Heading 1")
End Sub
Public Function funGetHeadingFromStyle(ByVal strStyleToFind As String) As String
Dim oPar As Paragraph
Dim lngIndex As Long
For Each oPar In ActiveDocument.Paragraphs
If oPar.Style = strStyleToFind Then
If lngIndex = 0 Then
funGetHeadingFromStyle = Left(oPar.Range.Text, Len(oPar.Range.Text) - 1)
Else
funGetHeadingFromStyle = funGetHeadingFromStyle & ", " & Left(oPar.Range.Text, Len(oPar.Range.Text) - 1)
End If
lngIndex = lngIndex + 1
End If
Next
End Function