Editing text in text box grouped within a trapezoid
Peter,
(this will be my last email, after that I'm on holiday:)
I checked in XL2K (I was using XL2002!) and you are right, it cannot be
done since the formula property is not updatable in a grouped items as
well!(although it does not error out)
the following code on XL2K failed:
Sub test()
Dim t As TextBox
Set t = ActiveSheet.Shapes(1).GroupItems(2).DrawingObject 'no inside
group selection possible in XL2K so we just get the object
Range("A1") = "mytext"
t.Formula = "$A$2"
't.Text = "text"
't.Characters.Text = "test"
Debug.Print t.Formula 'forumal not updated :(
End Sub
Solution for you might be
Sub test()
Dim v(1 To 4), i
Dim shp As Shape
Dim gi As Object
Dim ws As Worksheet
Set ws = ActiveSheet
ws.DrawingObjects.Delete
'first make 4 texboxes & group
For i = 1 To 4
Set shp = ws.Shapes.AddTextbox(1, 20, i * 20, 50, 15)
shp.DarwingObjects.Formula = Range("A1").offset(0,i) ' works when *not*
grouped
Range("A1").offset(0,i) = Chr(i + 64)
v(i) = shp.Name
Next
Set shp = ws.Shapes.Range(v).Group
Application.ScreenUpdating = True
i = 0
For Each gi In shp.GroupItems
i = i + 1
MsgBox gi.TextFrame.Characters.Text, , gi.Name
'gi.TextFrame.Characters.Text = i & " text"
'#1004 unable to set the text property
'gi.Select
'#70 Permission denied
Next
End Sub
DM Unseen
|