【发布时间】:2021-03-01 18:04:50
【问题描述】:
我正在尝试使用 Excel VBA 从 Excel 中的数据自动构建组织结构图。效果很好,但是,我想同时填写两个文本框。在大文本框中,我想填写部门的描述,在较小的文本框中,我想添加部门代码。
我找不到访问较小文本框的代码。
Do While Source.Cells(Line, 1) <> ""
If Source.Cells(Line, 3) = PID Then
Set ParNode = QNode
If Source.Cells(Line, 4) = 1 Then
Set QNode = QNode.AddNode(msoSmartArtNodeDefault, msoSmartArtNodeTypeAssistant)
Else: Set QNode = QNode.AddNode(msoSmartArtNodeBelow)
End If
QNode.TextFrame2.TextRange.Text = Cells(Line, 6)
'here something needs to be added !!!
CurPid = Source.Cells(Line, 2)
If Not Found Then Found = True 'something was find
'Source.Rows(Line).Delete
'Line = Line + 1
Call AddChildNodes(QNode, Source, CurPid)
Debug.Print ("CurPid" & CurPid)
Debug.Print ("line" & Line)
Set QNode = ParNode
'ElseIf Found Then 'it's sorted,so nothing else can be found
' Exit Do
'Else
End If
Line = Line + 1
Loop
【问题讨论】:
-
您是否尝试过手动录制宏?
-
@DirkReichel:有吗?并查看结果?
-
@teylyn 你是对的......录制不会有帮助......但是还有其他工具可以完美运行:)
-
@DirkReichel 其他工具是什么意思?
-
在我的回答中查看图片:)