统计求和图形中数据的程序源程序?求助
下面链接是一位朋友的统计求和图形中数据的程序源吗?谁能告诉我怎么用它好吗?是什么类型的!
<A href="dispbbs.asp?boardID=16&ID=16561&page=5" target="_blank" ><FONT color=#000000>dispbbs.asp?boardID=16&ID=16561&page=5</FONT></A>
统计求和图形中数据的程序源程序?求助
Sub totalnumber()<BR> Dim total As Double<BR> total = 0<BR> Dim ssetObj As AcadSelectionSet<BR> Set ssetObj = CreateSelectionSet("numberobj")<BR> Dim ftype, fdata<BR> BuildFilter ftype, fdata, 0, "text"<BR> ssetObj.SelectOnScreen ftype, fdata<BR> For i = 0 To ssetObj.Count - 1<BR> If IsNumeric(ssetObj.Item(i).TextString) Then<BR> total = total + ssetObj.Item(i).TextString<BR> Else<BR> End If<BR> Next i
ssetobj.delete<BR> ActiveDocument.Utility.Prompt "总和=" & total<BR>End Sub<BR>Public function CreateSelectionSet(Optional ssName As String = "ss") As AcadSelectionSet<BR> '返回一个空白选择集<BR> <BR> Dim ss As AcadSelectionSet<BR> <BR> On Error Resume Next<BR> Set ss = ThisDrawing.SelectionSets(ssName)<BR> If err Then Set ss = ThisDrawing.SelectionSets.Add(ssName)<BR> ss.Clear<BR> Set CreateSelectionSet = ss<BR>End Function<BR>Public Sub BuildFilter(typeArray, dataArray, ParamArray gCodes())<BR> '用数组方式填充一对变量以用作为选择集过滤器使用<BR> Dim ftype() As Integer, fdata()<BR> Dim index As Long, i As Long<BR> <BR> index = LBound(gCodes) - 1<BR> <BR> For i = LBound(gCodes) To UBound(gCodes) Step 2<BR> index = index + 1<BR> ReDim Preserve ftype(0 To index)<BR> ReDim Preserve fdata(0 To index)<BR> ftype(index) = CInt(gCodes(i))<BR> fdata(index) = gCodes(i + 1)<BR> Next<BR> typeArray = ftype: dataArray = fdata<BR>End Sub 在线等助! Ask the author & No VBA here.
页:
[1]