明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1236|回复: 1

[求助]请帮助看看错在哪里?

[复制链接]
发表于 2004-4-27 16:44:00 | 显示全部楼层 |阅读模式
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的代码窗口不支持鼠标滚轮么? 谢谢指教.
发表于 2004-4-27 18:04:00 | 显示全部楼层
Dim AcadApp As AcadApplication Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1")
AcadApp 未实例化,应用GetObject或CreateObject对AcadApp赋值 好像有一个VB鼠标滚轮伴侣的软件,你找找看
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-28 06:31 , Processed in 0.163942 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表