Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2015, 07:08 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,617
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
  #2  
Old 03-16-2015, 02:24 AM
NobodysPerfect NobodysPerfect is offline Retrieve page number of cross reference Windows 8 Retrieve page number of cross reference Office 2010 32bit
Competent Performer
Retrieve page number of cross reference
 
Join Date: Jan 2014
Location: Germany
Posts: 136
NobodysPerfect is on a distinguished road
Default

Hi,

Thanks for your answer.

Meanwhile I also tried:

Code:
Sub GetCrossReferences()
Dim oDoc As Document: Set oDoc = ActiveDocument
Dim myRefs As Variant, i As Long
   
    myRefs = oDoc.GetCrossReferenceItems(wdRefTypeHeading)
    For I = 1 To UBound(myRefs)
        With Selection.Find
            .Text = Trim$(myRefs(i))
            .Forward = True
        End With
        Selection.Find.Execute
        MsgBox myRefs(i) & " auf Seite:" & Selection.Information(wdActiveEndPageNumber), vbOKOnly
    Next
   
End Sub
Cheers
NP
Reply With Quote
Reply



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 06:27 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