通过vba代码填充形状上的属性 [英] Fill a property on shapes by vba code

查看:443
本文介绍了通过vba代码填充形状上的属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,我正在我公司的一个新项目,我需要做一些Visio 2016中的内容。 



我想编写一个vba代码,在形状数据中创建一个属性,然后用容器的形状名称填充它。有可能吗?



我已经编写了一个创建属性"Setor"的代码。在页面上的所有形状,但我需要使用形状所在的容器的名称填充此属性。 



< span style ="color:#222222; font-family:'Open Sans',sans-serif; font-size:16px">我使用的代码是:



Private Sub Setorizacao()



Dim visShape As Visio .shape

Dim visPage  As Visio.Page







设置visPage = ActivePage



对于每个visShape在ActivePage.Shapes

  

   if visShape.CellExists(" LockW idth",
False)然后


  

  调用InitSetor(visShape)

  

   End If

  

   Next

  

  

      

End Sub



Sub InitSetor(ByRef shape As Visio.shape)



'创建Prop.Setor如果它们不存在;将两个字段都设置为空



  如果不是shape.CellExistsU(" Prop.Se tor",
False)然后


     shape.AddNamedRow visSectionProp," Setor",visTagDefault

   End If

   shape.CellsU(" Prop.Setor") 。FormulaU
=""


   shape.CellsU(" Prop.Setor.L abel")。 mulaU
= Chr(34)& " Setor"&  Chr(34)


   

   

End Sub







提前谢谢。

Hey guys, Im on a new project in my company and I need to make some things in Visio 2016. 

I want to write a vba code that create a property in shape data and then fill it with the container's shape name. Is there possible?

Ive already wrote a code that creat a property "Setor" in all shapes on the page, but I need to fill this property with the name of a container the shapes are into. 

The code that Im using is this:

Private Sub Setorizacao()

Dim visShape As Visio.shape
Dim visPage  As Visio.Page



Set visPage = ActivePage

For Each visShape In ActivePage.Shapes
   
   If visShape.CellExists("LockWidth", False) Then
   
   Call InitSetor(visShape)
   
   End If
   
   Next
   
   
           
End Sub

Sub InitSetor(ByRef shape As Visio.shape)

' Create Prop.Setor if they don't exist; set both fields to null

    If Not shape.CellExistsU("Prop.Setor", False) Then
        shape.AddNamedRow visSectionProp, "Setor", visTagDefault
    End If
    shape.CellsU("Prop.Setor").FormulaU = ""
    shape.CellsU("Prop.Setor.Label").FormulaU = Chr(34) & "Setor" & Chr(34)
    
    
End Sub



Thank you in advance.

推荐答案

嗨卢卡斯,

感谢您访问我们的论坛。

Thanks for visiting our forum.

然后我们主要关注Visio客户端的一般问题。由于您的查询与VBA代码更相关,我会将您的主题移至专用的MSDN论坛用于Office开发以获得更好的响应。

Then here we mainly focus on general issues about Visio client. Since your query is more related to VBA code, I'll move your thread to the dedicated MSDN forum for Office development for better response.

问候,

Yuki Sun


这篇关于通过vba代码填充形状上的属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆