Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Tamara Tamara is offline
external usenet poster
 
Posts: 6
Default Formatting Field Code Text (Cross References and Bookmarks)

Is there a way to automate or use macros to globally reformat the text
appearing in cross references and bookmarks?

For example, this macro globally reformats field code text to be lowercase:

Sub FieldRefChanges1()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2 Then
'add format switch with lowercase option to field codes
oFld.Code.Text = oFld.Code.Text & "\* lower "
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub


I'd like to globally reformat cross references and bookmarks in a document
so that they appear with blue text instead of black. See page 3 of
ftp://ftp.software.ibm.com/systems/s...user-guide.pdf
as an example. Is it possible to use charformat or some other formatting
switch?

Any insight would be appreciated.

Thank you,
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Formatting Field Code Text (Cross References and Bookmarks)

If you add the \* CHARFORMAT switch, you can then format the REF field code
in blue. Something like this:

Sub FieldRefChanges2()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2 Then
'add charformat switch:
oFld.Code.Text = oFld.Code.Text & "\* CHARFORMAT "
oFld.Code.Font.Color = wdColorBlue
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub

--
Stefan Blom
Microsoft Word MVP



"Tamara" wrote in message
...
Is there a way to automate or use macros to globally reformat the text
appearing in cross references and bookmarks?

For example, this macro globally reformats field code text to be
lowercase:

Sub FieldRefChanges1()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2 Then
'add format switch with lowercase option to field codes
oFld.Code.Text = oFld.Code.Text & "\* lower "
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub


I'd like to globally reformat cross references and bookmarks in a document
so that they appear with blue text instead of black. See page 3 of
ftp://ftp.software.ibm.com/systems/s...user-guide.pdf
as an example. Is it possible to use charformat or some other formatting
switch?

Any insight would be appreciated.

Thank you,





  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Tamara Tamara is offline
external usenet poster
 
Posts: 6
Default Formatting Field Code Text (Cross References and Bookmarks)

Thanks. This worked!

"Stefan Blom" wrote:

If you add the \* CHARFORMAT switch, you can then format the REF field code
in blue. Something like this:

Sub FieldRefChanges2()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2 Then
'add charformat switch:
oFld.Code.Text = oFld.Code.Text & "\* CHARFORMAT "
oFld.Code.Font.Color = wdColorBlue
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub

--
Stefan Blom
Microsoft Word MVP



"Tamara" wrote in message
...
Is there a way to automate or use macros to globally reformat the text
appearing in cross references and bookmarks?

For example, this macro globally reformats field code text to be
lowercase:

Sub FieldRefChanges1()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2 Then
'add format switch with lowercase option to field codes
oFld.Code.Text = oFld.Code.Text & "\* lower "
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub


I'd like to globally reformat cross references and bookmarks in a document
so that they appear with blue text instead of black. See page 3 of
ftp://ftp.software.ibm.com/systems/s...user-guide.pdf
as an example. Is it possible to use charformat or some other formatting
switch?

Any insight would be appreciated.

Thank you,






  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Stefan Blom Stefan Blom is offline
external usenet poster
 
Posts: 8,428
Default Formatting Field Code Text (Cross References and Bookmarks)

I'm glad I could help.

--
Stefan Blom
Microsoft Word MVP



"Tamara" wrote in message
...
Thanks. This worked!

"Stefan Blom" wrote:

If you add the \* CHARFORMAT switch, you can then format the REF field
code
in blue. Something like this:

Sub FieldRefChanges2()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2
Then
'add charformat switch:
oFld.Code.Text = oFld.Code.Text & "\* CHARFORMAT "
oFld.Code.Font.Color = wdColorBlue
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub

--
Stefan Blom
Microsoft Word MVP



"Tamara" wrote in message
...
Is there a way to automate or use macros to globally reformat the text
appearing in cross references and bookmarks?

For example, this macro globally reformats field code text to be
lowercase:

Sub FieldRefChanges1()
On Error Resume Next
Dim oStoryRng As Range
Dim oFld As Field

For Each oStoryRng In ActiveDocument.StoryRanges
For Each oFld In oStoryRng.Fields
If oFld.Type = wdFieldRef And oFld.Result.Words.Count = 2
Then
'add format switch with lowercase option to field codes
oFld.Code.Text = oFld.Code.Text & "\* lower "
'updates the field results to display the new format
oFld.Update
End If
Next oFld
Next oStoryRng
End Sub


I'd like to globally reformat cross references and bookmarks in a
document
so that they appear with blue text instead of black. See page 3 of
ftp://ftp.software.ibm.com/systems/s...user-guide.pdf
as an example. Is it possible to use charformat or some other
formatting
switch?

Any insight would be appreciated.

Thank you,








Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting cross-references Gary[_3_] Formatting Long Documents 5 July 27th 08 10:41 PM
Stopping cross references from taking source text formatting? Darrell Microsoft Word Help 3 October 5th 06 06:51 PM
Updating cross references changes formatting of other text JoanG Microsoft Word Help 1 June 19th 06 11:18 AM
Formatting with Cross references Ianb Microsoft Word Help 2 November 3rd 05 12:21 AM
cross-references, bookmarks, and hyperlinks KK New Users 1 October 16th 05 02:13 PM


All times are GMT +1. The time now is 05:56 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"