sharksun 发表于 2004-4-27 16:44:00

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

Private Sub CommandButton1_Click()


Dim AcadApp As AcadApplication<BR>Dim StyObj1 As AcadTextStyle<BR>Dim Bold As Boolean<BR>Dim Italic As Boolean<BR>Dim charSet As Long<BR>Dim typeFace As String<BR>Dim PitchAndFamily As Long


<BR>Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1")<BR>typeFace = "宋体"<BR>Bold = True<BR>Italic = True<BR>charSet = 1<BR>PitchAndFamily = 1 Or 16<BR>StyObj1.SetFont typeFace, Bold, Italic, charSet, PitchAndFamily


Dim StyObj2 As AcadTextStyle<BR>Set StyObj2 = AcadApp.ActiveDocument.TextStyles.Add("A4")<BR>StyObj2.fontFile = "C:\WINDOWS\Fonts\STCaiyun.tif"<BR>Dim textObj As AcadText<BR>Dim textString As String<BR>Dim insertionPoint(0 To 2) As Double<BR>Dim height As Double


textString = "AutoCAD二次开发"<BR>height = 20<BR>insertionPoint(0) = 5: insertionPoint(1) = 2: insertionPoint(2) = 0


AcadApp.ActiveDocument.ActiveTextStyle = StyObj1<BR>Set textObj = AcadApp.ActiveDocument.ModelSpace.AddText(textString, insertionPoint, height)<BR>textObj.Update



错误出现在Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1")<BR>一行,提示为:变量或with块变量未设置,不知道为什么??


顺便问一下:vb/vba的代码窗口不支持鼠标滚轮么?


谢谢指教.

雪山飞狐_lzh 发表于 2004-4-27 18:04:00

Dim AcadApp As AcadApplication


Set StyObj1 = AcadApp.ActiveDocument.TextStyles.Add("A1")<BR>AcadApp 未实例化,应用GetObject或CreateObject对AcadApp赋值


好像有一个VB鼠标滚轮伴侣的软件,你找找看
页: [1]
查看完整版本: [求助]请帮助看看错在哪里?