Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #6  
Old 03-16-2015, 04:21 AM
gmaxey gmaxey is offline Retrieve page number of cross reference Windows 7 32bit Retrieve page number of cross reference 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

I think this would be faster and more comprehensive:

Code:
Sub GetHeadings()
Dim oDoc As Document: Set oDoc = ActiveDocument
Dim varHeadings As Variant, lngIndex As Long
Dim oRng As Word.Range
  varHeadings = oDoc.GetCrossReferenceItems(wdRefTypeHeading)
  Set oRng = oDoc.Range
  For lngIndex = 1 To UBound(varHeadings)
    With oRng.Find
      .Text = Trim$(varHeadings(lngIndex))
      .Forward = True
      If .Execute Then
        If Left(oRng.Paragraphs(1).Range.Style, Len("Heading")) = "Heading" Then
          MsgBox varHeadings(lngIndex) & " auf Seite:" & oRng.Information(wdActiveEndAdjustedPageNumber), vbOKOnly
        End If
        oRng.Collapse wdCollapseEnd
      End If
    End With
  Next
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Retrieve page number of cross reference Cross-reference function to update bullet header and number simultaneously dljenks Word 1 01-03-2014 01:38 PM
Retrieve page number of cross reference Reference number and cross reference for equation numbers to match the thesis format wmac Word 1 05-14-2013 08:54 PM
Cross Reference Heading Number with the word "Section" included bblouin Word 5 12-20-2012 05:27 PM
Retrieve page number of cross reference Need help with using bookmark and cross-reference mpdsal Word 1 07-26-2012 01:05 PM
2 figures cross reference mmdmov Word 0 05-05-2010 09:12 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:23 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft