我想判断getxdata返回的variant 是否empty,然后将里面的东西变成字符串返回,怎么不行啊?发生致命错误.
请高手指点一下.
Private Sub CommandButton2_Click() Dim ssetObj As AcadSelectionSet Dim elem As AcadObject Dim DataType As Variant Dim Data As Variant
On Error Resume Next ThisDrawing.SelectionSets("text").Delete Set ssetObj = ThisDrawing.SelectionSets.Add("text") Err.Clear On Error GoTo 0
' Add objects to a selection set by prompting user to select on the screen 'While (True) selectagain: ssetObj.SelectOnScreen For Each elem In ssetObj
If Right(elem.ObjectName, 4) = "Text" Then elem.GetXData ApplicationName, DataType, Data If IsEmpty(Data) <> True Then 'Label1.Caption = CStr(Data(0)) + " " + CStr(Data(1)) + " " + CStr(Data(2)) Label1.Caption = CStr(Data(0)) End If End If
Next ' Wend
If ssetObj.Count <> 0 Then ssetObj.Clear GoTo selectagain End If