遍历动态连接器以根据文本更改颜色

问题描述 投票:0回答:1

我需要遍历visio文档上的所有动态连接器,并根据动态连接器文本标签更改连接器线的颜色-该代码基于更改动态连接器线宽的先前问题。

我找不到定义文本标签的框

Sub Macro1()
Dim shp As Shape, mst As Master
' iterate all shapes per page
For Each shp In ActivePage.Shapes
    ' declare parent master for current shape
    Set mst = shp.Master
    ' Process only shapes that have parent master-shape
    If Not (mst Is Nothing) Then
        ' change only shapes, which master-shape is dynamic connector
        If mst.Name = "Dynamic connector" Then
            ' Now i dont know how to proceed - forgive me i am new to coding - i know the syntax is wrong, im just trying to give somthing to go off
            If shp.Text = "A" Then shp.Cells("LineColour").Formula = RGB(255,255,0))
        Else If shp.Text = "G" Then shp.Cells("LineColour").Formula = RGB(0,255,0))
        Else If shp.Text = "R" Then shp.Cells("LineColour").Formula = RGB(255,0,0))
    End If
    End

但是形状文本似乎不是属性-即使连接器明显具有文本,并且该文本的属性(如字体)也会出现。

任何帮助都会很棒-干杯

vba visio
1个回答
0
投票
也许:

ActivePage.Shapes(shp.Name).TextFrame.Characters.Text = "Hello World!"

© www.soinside.com 2019 - 2024. All rights reserved.