找到你要的答案

Q:vba updateable shape controls in master shape

Q:VBA更新形状控制的主控形状

I am having a bear of a time finding an answer to what seems like a simple question. I am using Visio 2010. I need to have something like text box that I can update through VBA. I have to code to do it

shape.CellsU("Prop.Memory").Formula = """256 MB"""

for example (shape is a variable in this case). The problem is that I can't find out how to tie a control, like a text box or label, to a user defined property like "Prop.memory" in this case. I thought it might be a data graphic but adding a data graphic is disabled for me.

Michael.

我有一个时间找到一个答案,什么似乎是一个简单的问题。我使用Visio 2010。我需要像文本框,我可以更新通过VBA。我得编码去做

shape.CellsU("Prop.Memory").Formula = """256 MB"""

例如(形状是这种情况下的变量)。问题是,在这种情况下,我找不到如何将控件(如文本框或标签)绑定到用户定义的属性,如“道具”。我认为这可能是一个数据图形,但增加了数据图形被禁用为我。

米迦勒。

answer1: 回答1:

I think that I have a solution. It is an odd one but it might work. The problem is that you cannot apply Data graphics when you have the master open in edit mode. what you can do is drop the master on the sheet based on the recordset. now you can add data graphics because it has a record source (I am guessing). I made the changes I need to that layout that I needed. I then dragged that shape to the stencil to become a new master. it will maintain the data links. it seems like an odd way to go about it but it does work. I might be good for now.

update: this didn't work for what I needed. I did find the way, though, on this site: Creating custom Visio shapes

Once you create the shape with the right fields, you have to use something like the following code to update it via VBA:

shp.cells("prop.Memory").Formula= chr(34) & "256 MB" & chr(34)

where shp is a visio shape

I just wanted to be the solution that I found is out there.

Cheers, Michael.

我想我有个解决办法。这是一个奇怪的,但它可能会工作。问题是,当您在编辑模式下打开主数据时,无法应用数据图形。你能做的就是放弃基于记录表的主人。现在,您可以添加数据图形,因为它有一个记录源(我猜)。我作出了我需要的布局,我需要的变化。然后我将这个形状拖到模板上成为一个新的主。它将保持数据链接。这似乎是一个奇怪的方式去做,但它的工作。我现在可能是好的。

更新:这不是我需要的工作。我没有找到出路,但在这个网站上:创建自定义Visio形状

一旦你创建的形状和正确的领域,你必须使用类似下面的代码通过VBA来更新它:

shp.cells("prop.Memory").Formula= chr(34) & "256 MB" & chr(34)

在小水电是Visio形状

我只是想成为我发现的解决方案。

Cheers, 米迦勒。

visio  visio-vba