atw: Re: VB macro to italicise cross references

Trivial matter to write one :-) Enjoy.


Public Sub XrefItalics()
'Italicises all xref field types

'DECLARATIONS

Dim BladeOfGrass As Field


'MAIN

'Iterate every field in the active document
For Each BladeOfGrass In ActiveDocument.Fields
   With BladeOfGrass 'using this field
      
      
      'IP
      
      Select Case .Type 'just test the Type of field it is
         Case wdFieldRef, wdFieldRefDoc, wdFieldPageRef 'All xref fields
            BladeOfGrass.Result.Italic = True
            'Alternatively, use
            'BladeOfGrass.Result.Style = wdStyleEmphasis
      
      End Select 'field type
   
   End With 'BladeOfGrass
Next 'BladeOfGrass
      
      
'TERMINATE

Set BladeOfGrass = Nothing
End Sub 

-----Original Message-----
From: austechwriter-bounce@xxxxxxxxxxxxx
[mailto:austechwriter-bounce@xxxxxxxxxxxxx] On Behalf Of Ilana Cohney
Sent: Friday, 16 June 2006 8:05 AM
To: austechwriter@xxxxxxxxxxxxx
Subject: atw: VB macro to italicise cross references

Hi all,
Does anyone know of a VB macro for Word that will automatically italicise
all cross references in a document?  I am not sure how to call up a cross
reference in VB code.  I suppose I could also live with having the macro
italicise all fields in the document, if it is not possible to identify the
fields that were actually cross references within the document. This would
save me a lot of manual work and must be quite a common operation for many
technical writers.
Thanks for your help.
Ilana
**************************************************
To post a message to austechwriter, send the message to
austechwriter@xxxxxxxxxxxxxx

To subscribe to austechwriter, send a message to
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.

To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with
"unsubscribe" in the Subject field.

To search the austechwriter archives, go to
www.freelists.org/archives/austechwriter

To contact the list administrator, send a message to
austechwriter-admins@xxxxxxxxxxxxx
**************************************************
**************************************************
To post a message to austechwriter, send the message to 
austechwriter@xxxxxxxxxxxxxx

To subscribe to austechwriter, send a message to 
austechwriter-request@xxxxxxxxxxxxx with "subscribe" in the Subject field.

To unsubscribe, send a message to austechwriter-request@xxxxxxxxxxxxx with 
"unsubscribe" in the Subject field.

To search the austechwriter archives, go to 
www.freelists.org/archives/austechwriter

To contact the list administrator, send a message to 
austechwriter-admins@xxxxxxxxxxxxx
**************************************************

Other related posts: