格式化使用“选择”创建的标题。 InsertCaption(Word VBA)

时间:2019-06-08 14:30:44

标签: vba ms-word word-vba-mac

我想用VBA在Word文档中格式化通过Selection.InsertCaption方法创建的标题(将文本居中于标题内,更改字体大小和颜色)。

到目前为止,我的代码:

For i = 1 To (mInlinShapes.Count) 'looping through my document inlineshapes
    If (mInlinShapes(i).Type = wdInlineShapePicture) Then
            Set Shp = mInlinShapes(i).ConvertToShape
            Shp.Select
            With Selection
                .InsertCaption Label:=wdCaptionFigure, _
                              Title:=" a custom title", _
                              Position:=wdCaptionPositionBelow, _
                              ExcludeLabel:=0

            End With
            Shp.ConvertToInlineShape
    End If
Next i 

如果可能的话,我宁愿避免循环浏览所有标题以应用格式。有想法吗?

1 个答案:

答案 0 :(得分:1)

这应该为您完成工作:

app.use(function(req, res, next) {
  next(createError(404));
});
// error handler
app.use(function(err, req, res, next) {
  // set locals, only providing error in development
  res.locals.message = err.message;
  res.locals.error = req.app.get('env') === 'development' ? err : {};
  // render the error page
  res.status(err.status || 500);
  res.render('error');
});

更多属性,请访问:Link