- 积分
- 1838
- 明经币
- 个
- 注册时间
- 2003-8-24
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
Private Sub CommandButton1_Click()
Dim AcadApp As AcadApplication Dim StyObj1 As AcadTextStyle Dim Bold As Boolean Dim Italic As Boolean Dim charSet As Long Dim typeFace As String Dim PitchAndFamily As Long
Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1") typeFace = "宋体" Bold = True Italic = True charSet = 1 PitchAndFamily = 1 Or 16 StyObj1.SetFont typeFace, Bold, Italic, charSet, PitchAndFamily
Dim StyObj2 As AcadTextStyle Set StyObj2 = AcadApp.ActiveDocument.TextStyles.Add("A4") StyObj2.fontFile = "C:\WINDOWS\Fonts\STCaiyun.tif" Dim textObj As AcadText Dim textString As String Dim insertionPoint(0 To 2) As Double Dim height As Double
textString = "AutoCAD二次开发" height = 20 insertionPoint(0) = 5: insertionPoint(1) = 2: insertionPoint(2) = 0
AcadApp.ActiveDocument.ActiveTextStyle = StyObj1 Set textObj = AcadApp.ActiveDocument.ModelSpace.AddText(textString, insertionPoint, height) textObj.Update
错误出现在Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1") 一行,提示为:变量或with块变量未设置,不知道为什么??
顺便问一下:vb/vba的代码窗口不支持鼠标滚轮么?
谢谢指教. |
|