vba - Visio 使用 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
但它返回运行时错误。我也试过
Dim str as String
str = Textbox2.value
Dim cell As Visio.cell
Set cell = shp.Cells("Prop.SO_Name")
cell.FormulaU = str
结果相同。
我查看了 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] 制作一个带有嵌入引号字符的字符串的一种方法。
推荐阅读
- php - 如何将 localhost 数据库连接到另一个服务器数据库并使用 codeigniter 插入表单值?
- linux - 使用 mkdir 数据设置后全新安装 gogs 出现恐慌:权限被拒绝
- pandas - 基于 TF -IDF 将每个文档转换为向量
- html - 插入文本旁边的插入符号而不是 contenteditable div 上的跨度
- android - 如何将文件列表作为 Retrofit 2 正文的一部分与 Android 中的其他常规字符串字段一起发送?
- r - R tmap 动态修改图例以防止图例值重叠
- google-apps-script - 根据过滤范围将数据从电子表格复制到另一个
- java - 如何在 XMLGregorianCalendar 中删除时间戳
- spring - 春季启动:禁用记录器
- java - 从firebase android中删除自动关键节点