|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
借楼上几位高手的思路,做了一个宏,把下面的宏加到代码里,点功能区的insert caption按钮,就直接生成 图1-1这种形式的了.注意宏名字不能修改.
Word 2007英文版下测试通过,其他环境没测试.
Sub InsertCaption()
Dim ZH1 As String, ZH2 As String
Dim TH As String
Selection.TypeText "图"
ZH1 = "QUOTE ""一九一一年一月日"" \@ ""D"""
Selection.Fields.Add Range:=Selection.Range, PreserveFormatting:=False, Text:=ZH1
Selection.EndKey
ActiveWindow.View.ShowFieldCodes = True
Selection.MoveLeft , 11
ZH2 = "STYLEREF 1 \s"
Selection.Fields.Add Range:=Selection.Range, PreserveFormatting:=False, Text:=ZH2
Selection.EndKey
Selection.TypeText "-"
TH = "SEQ 图 \* ARABIC \s 1"
Selection.Fields.Add Range:=Selection.Range, PreserveFormatting:=False, Text:=TH
ActiveWindow.View.ShowFieldCodes = False
Selection.WholeStory
Selection.Fields.Update
Selection.EndKey
End Sub
|
|