Gruppe
Allgemein
Problem
Zwei Zeilen unter der letzten genutzten Zelle in Spalte C soll eine TextBox mit einem 12.000 Zeichen langen Text eingefügt werden.
StandardModule: Modul1
Sub InsertTextBoxA()
Dim txtBox As Shape
Dim rng As Range
Dim iCounter As Integer
Set rng = Cells(Rows.Count, 3).End(xlUp).Offset(2, 0)
Set txtBox = Tabelle1.Shapes.AddTextbox( _
msoTextOrientationHorizontal, rng.Left, rng.Top, 400, 200)
For iCounter = 1 To 5
With txtBox.TextFrame.Characters
.Text = .Text & String(200, CStr(iCounter))
End With
Next iCounter
End Sub
Sub InsertTextBox()
Dim txtBox As OLEObject
Dim rng As Range
Dim iCounter As Integer
Set rng = Cells(Rows.Count, 3).End(xlUp).Offset(2, 0)
Set txtBox = Tabelle1.OLEObjects.Add( _
link:=False, _
displayasicon:=False, _
ClassType:="Forms.TextBox.1", _
Left:=rng.Left, _
Top:=rng.Top, _
Width:=400, _
Height:=200)
txtBox.Object.MultiLine = True
txtBox.Object.Text = String(12000, "X")
End Sub