gpt4 book ai didi

vba - 如何在Word宏中的TextBox中插入文本

转载 作者:行者123 更新时间:2023-12-04 20:42:26 24 4
gpt4 key购买 nike

我在 Word 中创建了一个文本框,我想在其中插入文本:

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

最佳答案

解决方法如下:

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

关于vba - 如何在Word宏中的TextBox中插入文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17126517/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com