Discussion:
使用vba 新增 textbox於sheets無法設定字型及文字對齊
(时间太久无法回复)
dandy
2007-04-14 02:32:01 UTC
Permalink
於2007excel sheets中以vba新增addtextbox 確無法設定字型及文字對齊:

ActiveSheet.Shapes.AddTextbox(msoTextOrientationVerticalFarEast, 556.5,
100.5 _
, 18#, 49.5).Select
With Selection.Characters(1, 3).Font
.Name = "華康新篆體"

end with
With Selection
'.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlRTL
end with
chijanzen
2007-04-14 03:06:00 UTC
Permalink
你好:

請參考以下程式碼

Sub test()
Dim tboxshape As Object
Set tboxshape = ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationVerticalFarEast, 550, 100, 30, 150)
With tboxshape
.DrawingObject.Font.Name = "新細明體"
.DrawingObject.VerticalAlignment = xlTop
.DrawingObject.ReadingOrder = xlRTL
.TextFrame.Characters.Text = "Testing"
End With
End Sub
--
天行健,君子以自強不息
地勢坤,君子以厚德載物

http://www.vba.com.tw/plog/


"dandy" 來函:
Post by dandy
ActiveSheet.Shapes.AddTextbox(msoTextOrientationVerticalFarEast, 556.5,
100.5 _
, 18#, 49.5).Select
With Selection.Characters(1, 3).Font
.Name = "華康新篆體"
end with
With Selection
'.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlRTL
end with
dandy
2007-04-14 03:42:01 UTC
Permalink
測試過不行耶!我的版本是2007
dandy

"chijanzen" 來函:
Post by chijanzen
請參考以下程式碼
Sub test()
Dim tboxshape As Object
Set tboxshape = ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationVerticalFarEast, 550, 100, 30, 150)
With tboxshape
.DrawingObject.Font.Name = "新細明體"
.DrawingObject.VerticalAlignment = xlTop
.DrawingObject.ReadingOrder = xlRTL
.TextFrame.Characters.Text = "Testing"
End With
End Sub
--
天行健,君子以自強不息
地勢坤,君子以厚德載物
http://www.vba.com.tw/plog/
"dandy" 來函:
Post by dandy
ActiveSheet.Shapes.AddTextbox(msoTextOrientationVerticalFarEast, 556.5,
100.5 _
, 18#, 49.5).Select
With Selection.Characters(1, 3).Font
.Name = "華康新篆體"
end with
With Selection
'.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlRTL
end with
dandy
2007-04-16 04:20:01 UTC
Permalink
再次測試發現中文不行 ,英文字體確可?

"dandy" 來函:
Post by dandy
測試過不行耶!我的版本是2007
dandy
"chijanzen" 來函:
Post by chijanzen
請參考以下程式碼
Sub test()
Dim tboxshape As Object
Set tboxshape = ActiveSheet.Shapes.AddTextbox( _
msoTextOrientationVerticalFarEast, 550, 100, 30, 150)
With tboxshape
.DrawingObject.Font.Name = "新細明體"
.DrawingObject.VerticalAlignment = xlTop
.DrawingObject.ReadingOrder = xlRTL
.TextFrame.Characters.Text = "Testing"
End With
End Sub
--
天行健,君子以自強不息
地勢坤,君子以厚德載物
http://www.vba.com.tw/plog/
"dandy" 來函:
Post by dandy
ActiveSheet.Shapes.AddTextbox(msoTextOrientationVerticalFarEast, 556.5,
100.5 _
, 18#, 49.5).Select
With Selection.Characters(1, 3).Font
.Name = "華康新篆體"
end with
With Selection
'.HorizontalAlignment = xlCenter
.VerticalAlignment = xlTop
.ReadingOrder = xlRTL
end with
Loading...