将以下代码插入到vb宏中运行,即可实现自动插入题注。
Sub 题注() ' 题注 宏 Selection.Find.ClearFormatting With Selection.Find .Text = "^p图^#" .Replacement.Text = " " .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchByte = False .MatchWildcards = False .MatchSoundsLike = False .MatchAllWordForms = False End With Selection.Find.Execute Selection.MoveLeft Unit:=wdCharacter, Count:=1 Selection.MoveRight Unit:=wdCharacter, Count:=1 Selection.InsertCaption Label:="图", TitleAutoText:="InsertCaption4", Title _ :="", Position:=wdCaptionPositionBelow, ExcludeLabel:=0 End Sub
如需清理题注内原有的手动标签,请依次替换"图^#^#"和"图^#",同时查找的样式需要设置为"题注"。