问题
I created a text bo in the Word and I would like to insert text into it:
Sub k()
Dim Box As Shape
Set Box = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=50, Top:=50, Width:=100, Height:=100)
//HOW TO INSERT HERE TEXT INTO TEXT BOX
End Sub
回答1:
Here is the solution:
Sub k()
Dim Box As Shape
Set Box = ActiveDocument.Shapes.AddTextbox( _
Orientation:=msoTextOrientationHorizontal, _
Left:=50, Top:=50, Width:=100, Height:=100)
'The solution for you:
Box.TextFrame.TextRange.Text = "My text comes this way"
End Sub
来源:https://stackoverflow.com/questions/17126517/how-to-insert-text-into-textbox-in-word-macro