使用基于索引的参考确定Shape是否在表中

时间:2016-03-15 08:28:31

标签: vba word-vba

要确定Shape是否在Table范围内,您可以使用以下代码:

 ActiveDocument.InlineShapes.Item(1).Select

 If Selection.Information(wdWithInTable) Then
      MsgBox "In Table"
 Else
      MsgBox "Not In Table"
 End If

我正在尝试从代码中删除所有Select / Selection等并转移到基于索引的引用,然后我可以使用Referenced形状执行各种更改。但我似乎无法弄清楚如何确定它是否在表中。

我需要类似的东西:

 Dim CurrentPicture As InlineShape
 Set CurrentPicture = ActiveDocument.InlineShapes.Item(1)

 If CurrentPicture.Information(wdWithInTable) Then
      MsgBox "In Table"
 Else
      MsgBox "Not In Table"
 End If

1 个答案:

答案 0 :(得分:0)

只需使用以下内容:

if (!String.prototype.startsWith) {
    String.prototype.startsWith = function(searchString, position){
      position = position || 0;
      return this.substr(position, searchString.length) === searchString;
  };
}