MS Word - 将文本设置为图像标题

问题描述

我有一个包含多张图片的文档。

在我通过 VBA 添加的每张图片下,都有一个标题,如“Fig.XX” 在这个标题下,我有一个短语应该是这张图片的标题描述。

我现在的问题是如何将标题下的文本放入占位符中? enter image description here

解决方法

例如:

Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "<<Placeholder>>^p"
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = True
    .Style = wdStyleCaption
  End With
  Do While .Find.Execute
    .Text = vbNullString
    .Style = wdStyleCaption
    .Collapse wdCollapseEnd
  Loop
End With
Application.ScreenUpdating = True
End Sub

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...