How to change autonumbering for captions of pictures?

A

avkokin

Hello.
There is a document which has many pictures and the captions for it.
The captions has such type: "Pic. 1.1.1".
I need to change this type of autonumbering of captions for such type:
"Pic. 1.1-1" into the document. But this numbering is the fields and
simple change of it through dialog "Find and Replace" not possible.
How to be?
Thank you very much.
 
D

Doug Robbins - Word MVP

Use

Dim afield As Field
Dim frange As Range
For Each afield In ActiveDocument.Fields
If afield.Type = wdFieldSequence Then
If InStr(afield.code.Text, "Figure") > 0 Then
Set frange = afield.code
afield.Unlink
frange.Start = frange.Start + InStr(frange, ".")
frange.Text = Replace(frange.Text, ".", "-")
End If
End If
Next afield

Note, they will no longer be fields, but there is no way of avoiding that
with the change that you wish to make.

--
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top