A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Formatting Long Documents
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

cross-references and hyperlinks



 
 
Thread Tools Display Modes
  #1  
Old February 5th, 2006, 08:31 AM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

Greetings. Does anyone here know how to change the font style Word uses for
cross-references?

I want my cross-references to have the appearance of hyperlinks, so that my
readers know they can Ctrl+click them to get to the cross-referenced
location.

Potential solutions I've tried and why they don't work for me:
1. Use actual hyperlinks: These don't give me the benefit of updated
cross-reference text based on updated text of the section, bookmark, or
whatever else I'm referencing.

2. Create the cross-reference and then format it as blue underlined text to
give it the appearance of a hyperlink. I do a lot of cross-referencing so I
wish there were some way I could set my cross-references to behave like this
by default. Also, I've noticed some funky formatting problems that occur
after I've done this, such as if I type directly to the right of text after
turning it to blue underline the new text is also blue underlined text....

Thanks in advance,
Jose


  #2  
Old February 5th, 2006, 08:48 AM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

I neglected to mention, I'm using Word 2003 SP1.

Jose


  #3  
Old February 5th, 2006, 10:28 AM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

Use a macro containing the following code:

Dim aref As Field
For Each aref In ActiveDocument.Fields
If aref.Type = wdFieldRef Then
With aref.result.Font
.Color = wdColorBlue
.Underline = wdUnderlineSingle
End With
End If
Next aref


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jose Durazo" wrote in message
...
Greetings. Does anyone here know how to change the font style Word uses
for cross-references?

I want my cross-references to have the appearance of hyperlinks, so that
my readers know they can Ctrl+click them to get to the cross-referenced
location.

Potential solutions I've tried and why they don't work for me:
1. Use actual hyperlinks: These don't give me the benefit of updated
cross-reference text based on updated text of the section, bookmark, or
whatever else I'm referencing.

2. Create the cross-reference and then format it as blue underlined text
to give it the appearance of a hyperlink. I do a lot of cross-referencing
so I wish there were some way I could set my cross-references to behave
like this by default. Also, I've noticed some funky formatting problems
that occur after I've done this, such as if I type directly to the right
of text after turning it to blue underline the new text is also blue
underlined text....

Thanks in advance,
Jose



  #4  
Old February 6th, 2006, 07:40 AM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

Doug, thanks for the help. I hadn't thought of a macro-based solution for
this, but this helped me save a lot of time.

For the benefit of others who want to use this solution, the check "If
aref.Type = wdFieldRef" is not quite right. When I remove this check, all
of my cross-references are correctly changed but some extra fields that
aren't really hyperlinks are turned to blue underlined text. I still have
to figure out which specific field types to check for, but I know I'm on the
right track now.

Thanks again!
Jose


  #5  
Old February 6th, 2006, 09:49 PM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

The following code should check to see if the \h (hyperlink) switch has been
added to the Ref field

Dim aref As Field
For Each aref In ActiveDocument.Fields
If aref.Type = wdFieldRef Then
If InStr(aref.Code, "\h") 0 Then
With aref.result.Font
.Color = wdColorBlue
.Underline = wdUnderlineSingle
End With
End If
End If
Next aref


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

"Jose Durazo" wrote in message
...
Doug, thanks for the help. I hadn't thought of a macro-based solution for
this, but this helped me save a lot of time.

For the benefit of others who want to use this solution, the check "If
aref.Type = wdFieldRef" is not quite right. When I remove this check, all
of my cross-references are correctly changed but some extra fields that
aren't really hyperlinks are turned to blue underlined text. I still have
to figure out which specific field types to check for, but I know I'm on
the right track now.

Thanks again!
Jose



  #6  
Old February 7th, 2006, 07:38 AM posted to microsoft.public.word.formatting.longdocs
external usenet poster
 
Posts: n/a
Default cross-references and hyperlinks

Thanks Doug, this works for everything except page numbers, so I changed the
test for field type to "If aref.Type = wdFieldRef Or aref.Type =
wdFieldPageRef Then". This now works almost perfectly. It also causes a
blue underline on page numbers in my TOC, so I tweaked the code to exclude
any references within the range of the TOC. Here's resulting code that
seems to work well:

Sub FormatCrossReferences()
Dim aref As Field

' TocRangeStart and end will be set to numbers greater
' than -1 if there's a table of contents in the document
' Macro assumes 0 or 1 table of contents
' Macro will not format items within the range of the TOC
Dim TocRangeStart As Integer
TocRangeStart = -1
Dim TocRangeEnd As Integer
TocRangeEnd = -1
Dim TOCCollection As TablesOfContents
Set TOCCollection = ActiveDocument.TablesOfContents
If Not (TOCCollection Is Nothing) Then
Dim TOC As TableOfContents
Set TOC = TOCCollection.Item(1)
TocRangeStart = TOC.Range.Start
TocRangeEnd = TOC.Range.End
End If

For Each aref In ActiveDocument.Fields
If (aref.Type = wdFieldRef Or aref.Type = wdFieldPageRef) _
And (aref.Result.Start TocRangeStart Or TocRangeEnd _
aref.Result.End) Then
With aref.Result.Font
.Color = wdColorBlue
.Underline = wdUnderlineSingle
End With
End If
Next aref
End Sub


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
word cross references do not update Seb Tables 6 August 22nd, 2005 05:18 PM
Can I force long hyperlinks to break when using justify? Al Bedo General Discussion 3 June 10th, 2005 04:40 PM
Using cross references and hyperlinks - Word 2000 Barb General Discussion 0 October 14th, 2004 09:59 PM
Table of Contents and Cross Referencing (variables) Help!!!! fvta Mailmerge 6 June 18th, 2004 05:47 PM
Updating hyperlinks Andy Wilkinson Links and Linking 1 December 3rd, 2003 01:16 AM


All times are GMT +1. The time now is 07:11 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.