I really hate to beat a dead horse, but I think the verbage is throwing me off. Here is one of the modules
Option Explicit
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 Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Public Function AddBKR()
Dim dimsc As Integer
dimsc = ThisDrawing.GetVariable("DIMSCALE")
Dim InsPT As Variant
Dim intOsMode As Integer
Dim dblRotation As Double
Dim objBlockRef As AcadBlockReference
'************** Esc Code *************
Dim varCancel As Variant
On Error GoTo Err_Control
'************** Esc Code *************
Call LayerSet("3D-EQPM", acRed)
intOsMode = ThisDrawing.GetVariable("OSMODE")
ThisDrawing.SetVariable "OSMODE", 32
InsPT = ThisDrawing.Utility.GetPoint(, "Pick Insertion Point: ")
ThisDrawing.SetVariable "OSMODE", 512
dblRotation = ThisDrawing.Utility.GetAngle(InsPT, "Pick Cabinet Side: ")
Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(InsPT, Path & "breaker.dwg", 1, 1, 1, dblRotation)
'************** Esc Code *************
Exit_Here:
LayerReSet
ThisDrawing.SetVariable "OSMODE", intOsMode
ThisDrawing.SetVariable "DIMSCALE", dimsc
ThisDrawing.SetVariable "INSUNITS", 1
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
what your saying is change to this?
Option Explicit
Public Enum CloseMode
CloseMode_Close=???
CloseMode_Cancel=&H1B ' Added here and I would reference CloseMode.CloseMode_Cancel ?
End Enum
Public Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Public Function AddBKR()
Dim dimsc As Integer
dimsc = ThisDrawing.GetVariable("DIMSCALE")
Dim InsPT As Variant
Dim intOsMode As Integer
Dim dblRotation As Double
Dim objBlockRef As AcadBlockReference
'************** Esc Code *************
Dim varCancel As Variant
On Error GoTo Err_Control
'************** Esc Code *************
Call LayerSet("3D-EQPM", acRed)
intOsMode = ThisDrawing.GetVariable("OSMODE")
ThisDrawing.SetVariable "OSMODE", 32
InsPT = ThisDrawing.Utility.GetPoint(, "Pick Insertion Point: ")
ThisDrawing.SetVariable "OSMODE", 512
dblRotation = ThisDrawing.Utility.GetAngle(InsPT, "Pick Cabinet Side: ")
Set objBlockRef = ThisDrawing.ModelSpace.InsertBlock(InsPT, Path & "breaker.dwg", 1, 1, 1, dblRotation)
'************** Esc Code *************
Exit_Here:
LayerReSet
ThisDrawing.SetVariable "OSMODE", intOsMode
ThisDrawing.SetVariable "DIMSCALE", dimsc
ThisDrawing.SetVariable "INSUNITS", 1
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