[原创]在excel的单元格中,获得圆的面积.
<p>在单元格中输入=ls()--------------- 采用的是excel的单元格自定义函数功能.<br/>自定义函数function ls() <br/>程序如下:</p><p>以下程序必须放在excel的bas模块中.<br/>Function ls() As Double<br/> Dim returnObj As AcadCircle<br/> Dim basePnt As Variant<br/><br/> With objModelDocument<br/> .Utility.GetEntity returnObj, basePnt, "选择一个圆"<br/> ls = returnObj.Area<br/> End With<br/>End Function<br/><br/>excel与autocad通讯程序如下 <br/><br/>Function objModelDocument() As AcadDocument<br/> Dim appAutoCad As AutoCAD.AcadApplication <br/> On Error Resume Next<br/> Set appAutoCad = GetObject(, "AutoCAD.Application")<br/> If Err Then<br/> Err.Clear<br/> Set appAutoCad = CreateObject("AutoCAD.Application")<br/> End If<br/> appAutoCad.Visible = True<br/> Dim AcadDoc As AcadDocument<br/> Set objModelDocument = appAutoCad.ActiveDocument<br/>End Function<br/></p> 可以用吗?
页:
[1]