Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 03-04-2016, 03:36 PM
here4singin here4singin is offline Define custom Cross-reference output format to include "static" text and pg numbers Windows 7 64bit Define custom Cross-reference output format to include "static" text and pg numbers Office 2013
Novice
 
Join Date: Mar 2016
Posts: 2
here4singin is on a distinguished road
Default Resolved

^^ see my post above ^^
With dev help, I now have a working macro! Here ya go:

Sub InsertXrefWithPage()
Dim StrNm As String
Dim Dlg As Dialog
Set Dlg = Dialogs(wdDialogInsertCrossReference)
Dlg.InsertAsHyperLink = 1
Dlg.Display
With Selection
Dim CurrentStyle As Style
Set CurrentStyle = .Style
.Start = .Start - 1
.Style = "insertnameofyourstylehere"
If .Fields.Count = 0 Then Exit Sub
StrNm = "PAGE" & LTrim(.Fields(1).Code.Text)
.Collapse wdCollapseEnd
.InsertAfter " (page "
.Style = CurrentStyle
.Collapse wdCollapseEnd
Dim addedField As Field
Set addedField = .Fields.Add(Range:=.Range, Type:=wdFieldEmpty, Text:=StrNm, PreserveFormatting:=False)
.InsertAfter ") "
End With
End Sub

The result is Running with Bears (page 67).
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Define custom Cross-reference output format to include "static" text and pg numbers Add static text to cross-reference tfa91 Word 7 10-09-2019 07:15 AM
Define custom Cross-reference output format to include "static" text and pg numbers Making cross-reference say "Fig." instead of "Figure" dgalb Word 17 11-09-2014 06:25 AM
Define custom Cross-reference output format to include "static" text and pg numbers 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
Define custom Cross-reference output format to include "static" text and pg numbers Is there a way to make the cross-refernce format to be "Only lable and number"? Jamal NUMAN Word 1 04-10-2011 03:31 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:25 PM.


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