
08-30-2012, 04:00 AM
|
Novice
|
|
Join Date: Aug 2012
Posts: 2
|
|
Quote:
Originally Posted by macropod
Unfortunately, there's nothing in the field code you can edit. If you select one of the fields and press Shift-F9, you'll be able to see the field code - and it won't have 'Figure', 'Table' or any other indicator of the caption type. If you were to use Find/Replace on the field results, that would be ineffective, as the fields will revert to their original display as soon as anything causes the cross-references to update. The only way around that - and it could be useful when the document is at it's 'Final' stage, would be to edit the display via a macro, then either lock or unlink the fields. The following macro uses a 'lock' approach, so that the references can be updated later on (by re-running the macro) if need be:
Code:
Sub AbbreviateCaptions()
Dim Fld As Field
For Each Fld In ActiveDocument.Fields
With Fld
If Left(.Result.Text, 6) = "Figure" Then
.Locked = False
.Update
.Result.Text = Replace(.Result.Text, "Figure", "Fig.", 1, 1)
.Locked = True
End If
End With
Next
End Sub
|
Thank you for the nice code. I found it useful. It is possible to the the same to also change the label at the figure captions. i.e. after application of the macro it says 'Figure 8' at the caption but 'Fig. 8' in the reference. Can the macro be modified to change the label in the figure caption too?
best regards
Nils
|