私は、TextBoxesをConnectorsに接続し、対話型スキーマを設計しています。また、コネクタの「強度」を示すスピンボタンもあります。今は、将来の使用のために要素の名前と値と接続を取得したいだけです。私の問題は、各スピンボタンをラベルでグルーピングしていることです(私の将来のコードではスピンボタンの値を表示できるようになります)。次のコードではスピンボタンの値を取得できません。私は成功のないsubshp.OLEFormat.Object.Value
のようなすべての種類のものを試しました。スピンボタンの値をラベル付きでグループ化する(Excel 2007)
文脈の完全なコードを貼り付けていますが、問題はFor Each subshp In shMyShape.GroupItems
の後のコードにあります。ありがとう。
Private Sub CB1_Click()
Dim shMyShape, subshp As Shape
Dim i As Long
Dim theSubShapes as String
Worksheets("MySchema").Range("A1:M100").ClearContents
i = 1
For Each shMyShape In Worksheets("MySchema").Shapes
If (shMyShape.Connector) Then
Worksheets("MySchema").Cells(i, 1) = "Shape name: "
Worksheets("MySchema").Cells(i, 2) = shMyShape.Name
Worksheets("MySchema").Cells(i, 3) = "Connector. Comes from " & shMyShape.ConnectorFormat.BeginConnectedShape.TextFrame.Characters.Text & " and goes to " & shMyShape.ConnectorFormat.EndConnectedShape.TextFrame.Characters.Text
i = i + 1
End If
If (shMyShape.Type = msoTextBox) Then
Worksheets("MySchema").Cells(i, 1) = "Shape name: "
Worksheets("MySchema").Cells(i, 2) = shMyShape.Name
Worksheets("MySchema").Cells(i, 3) = "Textbox, and its value is: " & shMyShape.TextFrame.Characters.Text
i = i + 1
End If
If (shMyShape.Type = msoGroup) Then
Worksheets("MySchema").Cells(i, 1) = "Shape name: "
Worksheets("MySchema").Cells(i, 2) = shMyShape.Name
theSubShapes = ""
'here starts my problem
For Each subshp In shMyShape.GroupItems
theSubShapes = theSubShapes & "-" & subshp.Name & "/" 'Here I need to get the spinbutton value (e.g., subshp.Value or subshp.OLEFormat.Object.Value)
Next subshp
Worksheets("MySchema").Cells(i, 3) = theSubShapes
i = i + 1
End If
Next
End Sub
を解決しました。誰かがここに来ると、最終的に解決策は 'subshp.OLEFormat.Object.Object.Value'でした。私の場合は論理的なアプローチではありませんが、試行錯誤してください:( – CMArg