bios8086 发表于 2008-5-13 18:24:00

为何取不到字符串

<p>&nbsp;Function getattributes(ByVal ThisDrawing As AcadDocument, ByVal dwgname As String, ByVal acadapp As AcadApplication)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim insertionPnt(0 To 2) As Double<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim blockRefObj As AcadBlockReference<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; insertionPnt(0) = 0.0# : insertionPnt(1) = 0.0# : insertionPnt(2) = 0.0#<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'insertionPnt(0) = 2.0# : insertionPnt(1) = 2.0# : insertionPnt(2) = 0<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; blockRefObj = ThisDrawing.ModelSpace.InsertBlock(insertionPnt, dwgname, 1.0#, 1.0#, 1.0#, 0)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '插入图形文件或当前图形中已定义的命名块。</p><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Get the attributes for the block reference<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim varAttributes As Object<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; varAttributes = blockRefObj.GetAttributes<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Move the attribute tags and values into a string to be displayed in a Msgbox<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim strAttributes As String<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim I As Integer<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; For I = LBound(varAttributes) To UBound(varAttributes)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; strAttributes = strAttributes &amp; "&nbsp; Tag: " &amp; varAttributes(I).TagString &amp; _<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "&nbsp;&nbsp; Value: " &amp; varAttributes(I).textString &amp; "&nbsp;&nbsp;&nbsp; "<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' MsgBox(varAttributes(I).textString)<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' MsgBox(varAttributes(I).TagString())<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Next<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MsgBox("The attributes for blockReference " &amp; blockRefObj.Name &amp; " are: " &amp; strAttributes, , "GetAttributes Example")<br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; '文件的名字blockRefObj.Name</p><p>&nbsp;&nbsp;&nbsp; End Function</p><p>varAttributes(I).TagString&nbsp;&nbsp; 不知道为什么&nbsp; 取不到任何字符串!</p>

azjmjsj 发表于 2008-5-13 23:32:00

函数应该有返回值

bios8086 发表于 2008-5-14 07:36:00

<p>不是 MsgBox("The attributes for blockReference " &amp; blockRefObj.Name &amp; " are: " &amp; strAttributes, , "GetAttributes Example")<br/>无法显示出来</p>
页: [1]
查看完整版本: 为何取不到字符串