Visio组织结构图形状着色问题:VBA修改ShapeSheet后无视觉变化
Visio组织结构图颜色设置问题
我通过Excel表格生成了一份Visio组织结构图,表格和图表中设有「Source」字段,用于区分岗位是内部填补还是外部招聘。我希望为内部、外部人员的形状设置不同颜色,同时将名称为「vacant」的空缺岗位设置为浅色调。
我编写了一段VBA代码,执行后ShapeSheet中的内容已被修改,但形状的颜色并未发生变化,即使手动修改ShapeSheet内容也无效。代码如下:
Sub ReColour() Dim shp As Visio.Shape Dim pagshape As Visio.Shape Set pagshape = Visio.ActivePage.PageSheet For Each shp In Visio.ActivePage.Shapes If shp.CellExistsU("prop.source", visExistsAnywhere) <> 0 Then 'Debug.Print shp.CellsU("prop.source").ResultStr(visNone) If shp.CellsU("prop.Source").ResultStr(visNone) = "HO - Full time (back filled)" Then shp.CellsU("Fillforegnd").FormulaU = "=THEMEGUARD(RGB(250,100,50))" shp.CellsU("FillBkgnd").FormulaU = "=THEMEGUARD(RGB(0,100,150))" shp.CellsU("Fillpattern").FormulaU = "27" Debug.Print shp.ID End If End If Next shp End Sub
另外,ShapeSheet中有一个user.backFillColor字段,其值被设置为sheet.25!FillForegnd(25为对应形状的ID),这与直接使用=fillForegnd不同,我困惑于sheet25!指向何处,因为同页面另一ID为155的形状指向sheet155!,并非其他页面。
内容的提问来源于stack exchange,提问作者Miles
相关产品推荐
相关产品推荐

