用VBA做个像“选择一个对象或[多个(m)]:”这样的程序
用VBA做个像“选择一个对象或[多个(m)]:”这样的程序,弄了好久多不知道怎么弄,哪位指点一下啊! 没人回答吗? 求助啊!!!!! 直接选择对象代码 不就行了吗?如果符合选项 就用的cond写一下On Error Resume Next
Dim StrKeyWords As String
StrKeyWords = "m"
ThisDrawing.Utility.GetEntity objDest, ptBase, vbCrLf & "选择一个对象或[多个(m)]:"
If Err Then ' 在错误处理中判断用户输入的关键字
If StrComp(Err.Description, "用户输入的是关键字", 1) = 0 Then
Dim strInput As String
strInput = ThisDrawing.Utility.GetInput
Err.Clear
' 根据输入的关键字进行相应的处理
If StrComp(strInput, "m", vbTextCompare) = 0 Then
......
Else
......
End If
Else
End If
End If
Private Sub SelectLots(ByVal Ssetname As String, ByVal objName As String)
Dim sSetObj As AcadSelectionSet, flag As Boolean
For Each sSetObj In ThisDrawing.SelectionSets
If sSetObj.Name = Ssetname Then flag = True: Exit For
Next
If flag Then sSetObj.Delete '创建集合,如集存在,则删除,新建
Set sSetObj = ThisDrawing.SelectionSets.Add(Ssetname)
Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
gpCode(0) = 0
dataValue(0) = objName
Dim groupCode As Variant, dataCode As Variant
groupCode = gpCode
dataCode = dataValue
ThisDrawing.Utility.Prompt "请选择**,可以框选" & vbCrLf
sSetObj.SelectOnScreen groupCode, dataCode
End Sub 谢谢各位热心人!!!
页:
[1]