HI~您好,欢迎您访问"北京金科合创软件官方网站",购买正版软件、海外正版软件商城就选金科软件(Goldk Software) 咨询热线:15210221926  金科软件-国内外正版软件服务商
您的位置: 首页>技术支持>think-cell

如何使用 VBA 查明某形状是否已由 think-cell 使用?

发布时间:2021-12-27 11:09:01点击量:

think-cell 遇到的每个形状都由某标记进行标记。除了 PowerPoint 形状之外,think-cell 可能还会将特殊形状(ActiveDocument 容器)放置在幻灯片、幻灯片母版或自定义布局上。该 ActiveDocument 容器不可见,并包含有关 think-cell 对象的特殊信息。
在 PowerPoint 对象模型中,每个 PowerPoint.Shape 对象都具有 Tags 集合。think-cell 会设置特殊标记 thinkcellShapeDoNotDelete 以协助识别形状。对于 ActiveDocument 容器,该特殊标记的值将设为 thinkcellActiveDocDoNotDelete,对于 think-cell 控制的所有其他形状,该值会以 t 开头。
示例:如何检查是否存在 think-cell 形状?
以下 VBA 函数将展示如何使用特殊标记对指定的 PowerPoint.Shape 对象进行归类:
Sub CheckShape(oShape As PowerPoint.Shape)
    Dim str As String
    str = oShape.Tags.Item(Name:="thinkcellShapeDoNotDelete")
    If (str = "" Or Left$(str, 1) <> "t") Then
        MsgBox "PowerPoint shape"
    Else
        If str = "thinkcellActiveDocDoNotDelete" Then
            MsgBox "think-cell ActiveDocument"
        Else
            MsgBox "think-cell shape"
        End If
    End If
End Sub
您可以使用此函数来识别活动幻灯片上的所有形状:
Sub Test()
    Dim oShape As PowerPoint.Shape
    For Each oShape In ActiveWindow.View.Slide.Shapes
        Call CheckShape(oShape)
    Next oShape
End Sub
请注意在您复制形状(例如,通过复制并粘贴 think-cell 图表的方式)时,也会复制每个形状的标记集合。CheckShape 会报告 think-cell shape,以指出已包含在 think-cell 图表中的所有形状,即使已将形状复制并粘贴到其他演示文稿中,也是如此。

上一篇:为什么在激活 think-cell 时我的 Excel 宏速度缓慢?

下一篇:当前日期或 *(星号)显示在 think-cell 标签中

微信公众号

  • 回到顶部
  • 15210221926
  • Goldk-AGE
  • 微信公众号