图 本来就具有图几的编号
Sub 自动添加图片题注()
'
' 自动添加图片题注 宏
'
'
'图片自动编号 宏
'主要由引用中的插入题注完成,再在编号与说明文字间输入2个空格,然后再将光标点移动两个空格之前,通过查找其之前的空格符,找到就删除题注与编号间的空格
'
Selection.HomeKey Unit:=wdStory
Do Until ActiveDocument.Bookmarks("\Sel") = ActiveDocument.Bookmarks("\EndOfDoc")
Selection.GoTo What:=wdGoToGraphic, Which:=wdGoToNext, Count:=1, Name:=""
Selection.MoveRight Unit:=wdWord, Count:=1, Extend:=True
If Selection.Type = 7 Then
' Selection.Collapse wdCollapseStart
' Selection.TypeText Text:="TEST"
' Selection.MoveRight unit:=wdWord, Count:=1, Extend:=False
Selection.InsertCaption Label:="图", TitleAutoText:="InsertCaption1", Title _
:="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
Selection.MoveDown Unit:=wdLine, Count:=1, Extend:=True
Selection.TypeBackspace
Selection.MoveRight Unit:=wdWord, Count:=2, Extend:=True
Selection.TypeBackspace
Else
Exit Sub
End If
Loop
'
' Selection.MoveRight unit:=wdCharacter, Count:=1, Extend:=wdExtend
'
' Selection.InsertCaption Label:="图", TitleAutoText:="InsertCaption2", Title _
' :="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0
' Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
End Sub