Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formatting cross-references | Formatting Long Documents | |||
Stopping cross references from taking source text formatting? | Microsoft Word Help | |||
Updating cross references changes formatting of other text | Microsoft Word Help | |||
Formatting with Cross references | Microsoft Word Help | |||
cross-references, bookmarks, and hyperlinks | New Users |