1
我想知道在Visual Basic 2010中是否有一種已知方法來「適合」文本框(假定文本不換行)。這可能有點等同於只需定義一個文本框並讓輸入的文本定義寬度/高度,就像在PowerPoint的GUI中一樣,新創建的文本框只是簡單地擴展爲一種類型。我的代碼如下:如何在Visual Basic 2010中調整文本框的大小
Set tbox1 = slideObject.Shapes.AddTextbox(Orientation:=msoTextOrientationHorizontal, Left:=20, Top:=300, Width:=72, Height:=16)
With tbox1.TextFrame.TextRange
.Text = "the text in the text box"
.Font.Bold = True
.Font.Name = "Calibri"
.Font.Size = 10
End With
With tbox1.Fill
.Visible = True
.ForeColor.RGB = RGB(255, 255, 255)
End With
With tbox1.Line
.Visible = True
.ForeColor.RGB = RGB(0, 0, 0)
.Weight = 2
End With
感謝您的幫助!
你在使用VB.NET還是VBA?從你的問題+標籤不清楚... –
VBA,我相信。不管PowerPoint GUI中的宏編輯器是什麼。 – HotDogCannon