Jeff_M 发表于 2007-1-17 12:59:10

能不能贴一下EntSel函数?这是失踪人员

Bryco 发表于 2007-1-18 00:15:53

它在vba函数Matt中。(他们好像消失了。)


Public Const VK_ESCAPE = &H1B
Public Const VK_LBUTTON = &H1
Public Const VK_SPACE = &H20
Public Const VK_RETURN = &HD
Public Const VK_LEFT = &H25
Public Const VK_MBUTTON = &H4
Public Declare Function GetAsyncKeyState Lib "user32" _
      (ByVal vKey As Long) As Integer
'Randall single selection
Public Function EntSel(Optional strPrmt As String = "Select an entity: ", Optional vPoint As Variant) As AcadEntity
    Dim objTemp As AcadEntity
    Dim objUtil As AcadUtility
    Dim varPnt As Variant
    Dim varCancel As Variant
    On Error GoTo Err_Control
    Set objUtil = ThisDrawing.Utility
    objUtil.GetEntity objTemp, varPnt, vbCr & strPrmt
    Set EntSel = objTemp
    If Not IsMissing(vPoint) Then
      vPoint = ToWcs(varPnt) ',,,,,,,,Added
    End If
Exit_Here:
    Exit Function
Err_Control:
    Select Case Err.Number
      Case -2147352567
      'Debug.Print Err.Number, Err.Description
      varCancel = ThisDrawing.GetVariable("LASTPROMPT")
      If InStr(1, varCancel, "*Cancel*")0 Then
            If GetAsyncKeyState(VK_ESCAPE) And 8000 > 0 Then
                Err.Clear
                Resume Exit_Here
            ElseIf GetAsyncKeyState(VK_LBUTTON) > 0 Then
                Err.Clear
                Resume
            End If
      Else
            If GetAsyncKeyState(VK_SPACE) Then
                Resume Exit_Here
            End If
            'Missed the pick, send them back!
            Err.Clear
            Resume
      End If
      Case Else
            MsgBox Err.Description
            Resume Exit_Here
    End Select
End Function
页: 1 [2]
查看完整版本: 选取点 - 获取表格单元格