View Single Post
 
Old 03-13-2015, 07:08 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim arrHeadings() As String
Dim lngIndex As Long, lngHeading As Long
  For lngIndex = 1 To ActiveDocument.Paragraphs.Count
    If Left(ActiveDocument.Paragraphs(lngIndex).Range.Style, Len("Heading")) = "Heading" Then
      ReDim Preserve arrHeadings(1, lngHeading)
      arrHeadings(0, lngHeading) = ActiveDocument.Paragraphs(lngIndex).Range.Text
      arrHeadings(1, lngHeading) = ActiveDocument.Paragraphs(lngIndex).Range.Information(wdActiveEndPageNumber)
      lngHeading = lngHeading + 1
    End If
  Next
  With UserForm1
    .listHeadings.Column = arrHeadings
    .listHeadings.ColumnCount = 2
    .listHeadings.ColumnWidths = "100;20"
    .Show
  End With
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote