Visio 将形状 Data/Properties 更改为 VBA
Visio Change Shape Data/Properties with VBA
对于一个项目,我正在创建一个用户窗体,它从文本框中读取值并使用数据生成形状。
所以在删除形状后我想更改形状数据行,例如 "Prop.SO_Name".
当我使用
shp.CellsU("Prop.SO_Name").FormulaU = """Test"""
它工作得很好。但我想从文本框中读取一个值。我试过了
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = TextBox2.Value
但它 returns 是一个运行时错误。我也试过
Dim str as String
str = Textbox2.value
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = str
同样的结果。
我调查了 documentation 的 FormulaU 属性,但他们显然是这样做的,就像我试过的那样。显然我错过了一些东西。
`尝试使用
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = chr(34) & UserForm1.TextBox2.Value & chr(34)
更新您尝试将字符串写入 ShapeSheet 单元格!字符串中的双引号是告诉 VB[A] 制作一个带有嵌入引号字符的字符串的一种方式。
对于一个项目,我正在创建一个用户窗体,它从文本框中读取值并使用数据生成形状。 所以在删除形状后我想更改形状数据行,例如 "Prop.SO_Name".
当我使用
shp.CellsU("Prop.SO_Name").FormulaU = """Test"""
它工作得很好。但我想从文本框中读取一个值。我试过了
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = TextBox2.Value
但它 returns 是一个运行时错误。我也试过
Dim str as String
str = Textbox2.value
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = str
同样的结果。
我调查了 documentation 的 FormulaU 属性,但他们显然是这样做的,就像我试过的那样。显然我错过了一些东西。
`尝试使用
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = chr(34) & UserForm1.TextBox2.Value & chr(34)
更新您尝试将字符串写入 ShapeSheet 单元格!字符串中的双引号是告诉 VB[A] 制作一个带有嵌入引号字符的字符串的一种方式。