![]() |
#4
|
|||
|
|||
![]()
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 |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
boxhamster | Word | 5 | 08-15-2015 03:25 PM |
LaTeX style table of contents in MS Word | MichaelHenrotte | Word | 1 | 11-23-2014 03:16 AM |
![]() |
Jetheat | Word | 4 | 12-15-2013 03:54 PM |
How to have this Heading – Table of contents style? | Jamal NUMAN | Word | 0 | 01-13-2011 06:02 PM |
Word 2003 Table of Contents Error Message | ktcolburn | Word | 1 | 10-30-2005 06:14 PM |