兰州人 发表于 2006-8-5 12:18:00

HandletoObject在VB中如何写

<P>在AutoCad的VBA中调试成功如下语句.</P>
<P>set EntyObj = ThisDrawing.HandletoObject("54EA") '句柄</P>
<P>EntyObj.color = acRed '通过句柄的实体变成红色</P>
<P>上面语句移植到VB中,语句定义出错.</P>
<P>请教各位大侠,</P>
<P>set EntyObj = ThisDrawing.HandletoObject("54EA") 这句话如何改</P>
<P>谢谢</P>

雪山飞狐_lzh 发表于 2006-8-6 15:31:00

<P>&nbsp;ThisDrawing是空值么?</P>
<P>&nbsp;</P>

wyj7485 发表于 2006-8-7 10:40:00

<P>1,先引用acad</P>
<P>2,调用acad</P>
<P>Public Function CallCAD()<BR>On Error Resume Next<BR>Dim AcadApp As AcadApplication<BR>Set AcadApp = GetObject(, "AutoCAD.Application")<BR>If Err Then<BR>Err.Clear<BR>Set AcadApp = CreateObject("AutoCAD.Application")<BR>AcadApp.Visible = True<BR>If Err Then<BR>MsgBox Err.Description<BR>Exit Function<BR>End If<BR>End If<BR>Set acadDoc = AcadApp.ActiveDocument<BR>End Function</P>
<P>3,set EntyObj = acadDoc.HandletoObject("54EA") </P>

crazylsp 发表于 2012-10-11 17:11:37


谢谢
页: [1]
查看完整版本: HandletoObject在VB中如何写