<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302097#M66229</link>
    <description>From&lt;BR /&gt;
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/&lt;BR /&gt;
html/msdn_msdn27.asp&lt;BR /&gt;
&lt;BR /&gt;
GetAsyncKeyState returns a non-zero value if the specified key or button is&lt;BR /&gt;
currently pressed. It will also return a non-zero value if the key or button&lt;BR /&gt;
was pressed since the last call to this function. The CONSTANT.TXT file&lt;BR /&gt;
contains a list of the virtual key constants.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I found the above link by doing a google search on "Declare Function&lt;BR /&gt;
GetAsyncKeyState".  There are probably other useful links from this same&lt;BR /&gt;
search.&lt;BR /&gt;
&lt;BR /&gt;
Here's the thread Marko was talking about (long link):&lt;BR /&gt;
http://groups.google.com/groups?hl=en&amp;amp;lr=&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;threadm=16FD9B7E&lt;BR /&gt;
8385F3F1587C9F58BB801AB9%40in.WebX.maYIadrTaRb&amp;amp;rnum=3&amp;amp;prev=/groups%3Fq%3Desc&lt;BR /&gt;
%2Bkey%2Bgroup:autodesk.autocad.customization.vba%26hl%3Den%26lr%3D%26ie%3DU&lt;BR /&gt;
TF-8%26oe%3DUTF-8%26selm%3D16FD9B7E8385F3F1587C9F58BB801AB9%2540in.WebX.maYI&lt;BR /&gt;
adrTaRb%26rnum%3D3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I got to this by clicking the Groups tab at Google, searching for "autocad&lt;BR /&gt;
customization" as a quick way to get to this newsgroup, and then doing a&lt;BR /&gt;
search on "esc key".  There's a very helpful radio button to limit the&lt;BR /&gt;
search to this newsgroup.  There were several other threads on ESC key, they&lt;BR /&gt;
may also be useful to you.&lt;BR /&gt;
&lt;BR /&gt;
Good luck,&lt;BR /&gt;
James</description>
    <pubDate>Tue, 04 Feb 2003 08:20:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2003-02-04T08:20:59Z</dc:date>
    <item>
      <title>Detecting KeyPress</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302092#M66224</link>
      <description>Can I intercept keypresses (e.g. ESC), the user may press while a form &lt;BR /&gt;
is hidden and a method (e.g. .GetPoint()), is being executed?&lt;BR /&gt;
&lt;BR /&gt;
Thanks&lt;BR /&gt;
Tom</description>
      <pubDate>Mon, 03 Feb 2003 14:42:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302092#M66224</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-03T14:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting KeyPress</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302093#M66225</link>
      <description>I think that you will find the answer that you need in the thread from&lt;BR /&gt;
21.01.2003 "Trapping an ESC key and terminating the program" which was&lt;BR /&gt;
started by me. If it is already gone from your news reader, you can find it&lt;BR /&gt;
through Google News search by typing&lt;BR /&gt;
    Trapping an ESC group:autodesk.autocad.customization.vba&lt;BR /&gt;
in the search box.&lt;BR /&gt;
You can contact me if you need any additional information.&lt;BR /&gt;
&lt;BR /&gt;
Regards, Marko.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
"TBerry" &lt;TBERRY&gt; wrote in message news:3E3EF072.4010209@vhb.com...&lt;BR /&gt;
&amp;gt; Can I intercept keypresses (e.g. ESC), the user may press while a form&lt;BR /&gt;
&amp;gt; is hidden and a method (e.g. .GetPoint()), is being executed?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;</description>
      <pubDate>Mon, 03 Feb 2003 23:25:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302093#M66225</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-03T23:25:26Z</dc:date>
    </item>
    <item>
      <title>Re: Detecting KeyPress</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302094#M66226</link>
      <description>Declare Function GetAsyncKeyState Lib "user32" _&lt;BR /&gt;
(ByVal vKey As Long) As Integer&lt;BR /&gt;
'This is a constant that represents the "ESC" key and is the&lt;BR /&gt;
'Key value that will be used for the above function&lt;BR /&gt;
Public Const VK_ESCAPE = &amp;amp;H1B&lt;BR /&gt;
&lt;BR /&gt;
"TBerry" &lt;TBERRY&gt; wrote in message news:3E3EF072.4010209@vhb.com...&lt;BR /&gt;
&amp;gt; Can I intercept keypresses (e.g. ESC), the user may press while a form&lt;BR /&gt;
&amp;gt; is hidden and a method (e.g. .GetPoint()), is being executed?&lt;BR /&gt;
&amp;gt;&lt;BR /&gt;
&amp;gt; Thanks&lt;BR /&gt;
&amp;gt; Tom&lt;BR /&gt;
&amp;gt;&lt;/TBERRY&gt;</description>
      <pubDate>Tue, 04 Feb 2003 03:37:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302094#M66226</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T03:37:36Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302095#M66227</link>
      <description>Marko,&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
I searched for this in Google but all references to it relate to Excel (Application.EnableCancelKey&lt;BR /&gt;
= xlErrorHandler). What did you use for AutoCAD?&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Thank you&lt;BR /&gt;&lt;BR /&gt;
Tom&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Marko Rogic wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE type="cite" cite="mid:9981AFEFD96240C6513712BC70926137@in.WebX.maYIadrTaRb"&gt;&lt;BR /&gt;
  &lt;PRE wrap=""&gt;I think that you will find the answer that you need in the thread from&lt;BR /&gt;21.01.2003 "Trapping an ESC key and terminating the program" which was&lt;BR /&gt;started by me. If it is already gone from your news reader, you can find it&lt;BR /&gt;through Google News search by typing&lt;BR /&gt;    Trapping an ESC group:autodesk.autocad.customization.vba&lt;BR /&gt;in the search box.&lt;BR /&gt;You can contact me if you need any additional information.&lt;BR /&gt;&lt;BR /&gt;Regards, Marko.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;"TBerry" &lt;A class="moz-txt-link-rfc2396E" href="mailto:tberry@vhb.com"&gt;&amp;lt;tberry@vhb.com&amp;gt;&lt;/A&gt; wrote in message &lt;A class="moz-txt-link-freetext" href="news:3E3EF072.4010209@vhb.com"&gt;news:3E3EF072.4010209@vhb.com&lt;/A&gt;...&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
  &lt;BLOCKQUOTE type="cite"&gt;&lt;BR /&gt;
    &lt;PRE wrap=""&gt;Can I intercept keypresses (e.g. ESC), the user may press while a form&lt;BR /&gt;is hidden and a method (e.g. .GetPoint()), is being executed?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Tom&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
    &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
    &lt;PRE wrap=""&gt;&lt;!----&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
    &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
    &lt;BR /&gt;</description>
      <pubDate>Tue, 04 Feb 2003 07:44:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302095#M66227</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T07:44:20Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302096#M66228</link>
      <description>LHGO,&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
I do very little VB/VBA programming (Delphi &amp;amp; Java 98% of time), so I'm&lt;BR /&gt;
at a loss for using this. I declared it in a module and then tried to use&lt;BR /&gt;
the function. When I run the VBA code, the error message "Compile error:&lt;BR /&gt;
Ambiguous name detected: GetAsyncKeyState". How do I implement this function?&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
Thanks&lt;BR /&gt;&lt;BR /&gt;
Tom&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
LHGO wrote:&lt;BR /&gt;&lt;BR /&gt;
&lt;BLOCKQUOTE type="cite" cite="mid:D6B9A300D9030CAB4691602327F21D71@in.WebX.maYIadrTaRb"&gt;&lt;BR /&gt;
  &lt;PRE wrap=""&gt;Declare Function GetAsyncKeyState Lib "user32" _&lt;BR /&gt;(ByVal vKey As Long) As Integer&lt;BR /&gt;'This is a constant that represents the "ESC" key and is the&lt;BR /&gt;'Key value that will be used for the above function&lt;BR /&gt;Public Const VK_ESCAPE = &amp;amp;H1B&lt;BR /&gt;&lt;BR /&gt;"TBerry" &lt;A class="moz-txt-link-rfc2396E" href="mailto:tberry@vhb.com"&gt;&amp;lt;tberry@vhb.com&amp;gt;&lt;/A&gt; wrote in message &lt;A class="moz-txt-link-freetext" href="news:3E3EF072.4010209@vhb.com"&gt;news:3E3EF072.4010209@vhb.com&lt;/A&gt;...&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
  &lt;BLOCKQUOTE type="cite"&gt;&lt;BR /&gt;
    &lt;PRE wrap=""&gt;Can I intercept keypresses (e.g. ESC), the user may press while a form&lt;BR /&gt;is hidden and a method (e.g. .GetPoint()), is being executed?&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Tom&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
    &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
    &lt;PRE wrap=""&gt;&lt;!----&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;
    &lt;/BLOCKQUOTE&gt;&lt;BR /&gt;
    &lt;BR /&gt;</description>
      <pubDate>Tue, 04 Feb 2003 07:49:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302096#M66228</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T07:49:37Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302097#M66229</link>
      <description>From&lt;BR /&gt;
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarvbtips/&lt;BR /&gt;
html/msdn_msdn27.asp&lt;BR /&gt;
&lt;BR /&gt;
GetAsyncKeyState returns a non-zero value if the specified key or button is&lt;BR /&gt;
currently pressed. It will also return a non-zero value if the key or button&lt;BR /&gt;
was pressed since the last call to this function. The CONSTANT.TXT file&lt;BR /&gt;
contains a list of the virtual key constants.&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I found the above link by doing a google search on "Declare Function&lt;BR /&gt;
GetAsyncKeyState".  There are probably other useful links from this same&lt;BR /&gt;
search.&lt;BR /&gt;
&lt;BR /&gt;
Here's the thread Marko was talking about (long link):&lt;BR /&gt;
http://groups.google.com/groups?hl=en&amp;amp;lr=&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;threadm=16FD9B7E&lt;BR /&gt;
8385F3F1587C9F58BB801AB9%40in.WebX.maYIadrTaRb&amp;amp;rnum=3&amp;amp;prev=/groups%3Fq%3Desc&lt;BR /&gt;
%2Bkey%2Bgroup:autodesk.autocad.customization.vba%26hl%3Den%26lr%3D%26ie%3DU&lt;BR /&gt;
TF-8%26oe%3DUTF-8%26selm%3D16FD9B7E8385F3F1587C9F58BB801AB9%2540in.WebX.maYI&lt;BR /&gt;
adrTaRb%26rnum%3D3&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
I got to this by clicking the Groups tab at Google, searching for "autocad&lt;BR /&gt;
customization" as a quick way to get to this newsgroup, and then doing a&lt;BR /&gt;
search on "esc key".  There's a very helpful radio button to limit the&lt;BR /&gt;
search to this newsgroup.  There were several other threads on ESC key, they&lt;BR /&gt;
may also be useful to you.&lt;BR /&gt;
&lt;BR /&gt;
Good luck,&lt;BR /&gt;
James</description>
      <pubDate>Tue, 04 Feb 2003 08:20:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302097#M66229</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T08:20:59Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302098#M66230</link>
      <description>Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer&lt;BR /&gt;
Private Const VK_ESCAPE = &amp;amp;H1B&lt;BR /&gt;
Private Const VK_LBUTTON = &amp;amp;H1&lt;BR /&gt;
 &lt;BR /&gt;
&lt;BR /&gt;
   Select Case Err.Number&lt;BR /&gt;
       Case -2147352567&lt;BR /&gt;
           If GetAsyncKeyState(VK_ESCAPE) And &amp;amp;H8000 &amp;gt; 0 Then&lt;BR /&gt;
               Err.Clear&lt;BR /&gt;
               Resume Exit_Here&lt;BR /&gt;
           ElseIf GetAsyncKeyState(VK_LBUTTON) &amp;gt; 0 Then&lt;BR /&gt;
               Err.Clear&lt;BR /&gt;
               Resume&lt;BR /&gt;
           Else&lt;BR /&gt;
               Err.Clear&lt;BR /&gt;
               Resume&lt;BR /&gt;
           End If&lt;BR /&gt;
       Case Else&lt;BR /&gt;
           Call ErrorMsgBox(Err)&lt;BR /&gt;
           Resume Exit_Here&lt;BR /&gt;
   End Select</description>
      <pubDate>Tue, 04 Feb 2003 09:38:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302098#M66230</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T09:38:58Z</dc:date>
    </item>
    <item>
      <title>Re:</title>
      <link>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302099#M66231</link>
      <description>&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Hi Tom, this is copied from above mentioned thread. &lt;BR /&gt;
Hope that it helps.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Marko.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;------------&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;Gary, the reason, why the code that you find on &lt;BR /&gt;
this ng doesn't work "out of the box", is that this are usually just pieces of &lt;BR /&gt;
the code and normally you have to add a few pieces by yourself&amp;nbsp;for the code &lt;BR /&gt;
to come to life. Try the following.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;1. Open VBA window under an AutoCAD and add a new &lt;BR /&gt;
UserForm.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;2. Then add standard Module.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;3. Go to the standard Module and copy to it the &lt;BR /&gt;
following lines of code from the example:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Option &lt;BR /&gt;
Explicit&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public &lt;BR /&gt;
Declare Function GetAsyncKeyState Lib "user32" _&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; (ByVal vKey As Long) As Integer&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public Const &lt;BR /&gt;
VK_ESCAPE = &amp;amp;H1B&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public Const &lt;BR /&gt;
VK_LBUTTON = &amp;amp;H1&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;4. Then go to UserForm and add a Command Button and &lt;BR /&gt;
name it cmdOK.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;5. Switch to the Code view of the UserForm and add &lt;BR /&gt;
the following function from the example:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Public &lt;BR /&gt;
Function EntSel(strPrmt As String) As AcadEntity&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim objTemp As &lt;BR /&gt;
AcadEntity&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim &lt;BR /&gt;
objUtil As AcadUtility&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim varPnt As Variant&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Dim varCancel As &lt;BR /&gt;
Variant&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; On Error &lt;BR /&gt;
GoTo Err_Control&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Set &lt;BR /&gt;
objUtil = ThisDrawing.Utility&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; objUtil.GetEntity objTemp, varPnt, &lt;BR /&gt;
strPrmt&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Set EntSel = &lt;BR /&gt;
objTemp&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Exit_Here:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Exit &lt;BR /&gt;
Function&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Err_Control:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; Select &lt;BR /&gt;
Case Err.Number&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case &lt;BR /&gt;
-2147352567&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; varCancel = &lt;BR /&gt;
ThisDrawing.GetVariable("LASTPROMPT")&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; If InStr(1, varCancel, "*Cancel*") &amp;lt;&amp;gt; 0 &lt;BR /&gt;
Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; If GetAsyncKeyState(VK_ESCAPE) &lt;BR /&gt;
And 8000 &amp;gt; 0 &lt;BR /&gt;
Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Err.Clear&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Resume &lt;BR /&gt;
Exit_Here&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf &lt;BR /&gt;
GetAsyncKeyState(VK_LBUTTON) &amp;gt; 0 &lt;BR /&gt;
Then&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Err.Clear&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Resume&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End &lt;BR /&gt;
If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 'Missed the pick, send them &lt;BR /&gt;
back!&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Resume&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End &lt;BR /&gt;
If&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Case &lt;BR /&gt;
Else&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MsgBox &lt;BR /&gt;
Err.Description&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Resume Exit_Here&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; End Select&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; End &lt;BR /&gt;
Function&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;6. Go back to the Object view of your UserForm and &lt;BR /&gt;
double click on a command button that you added two steps back. VBA will &lt;BR /&gt;
automatically switch over to Code window and add initial part of code for your &lt;BR /&gt;
command button. Add the following lines between the start and end of the sub so &lt;BR /&gt;
that it looks like this:&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Private Sub &lt;BR /&gt;
cmdOK_Click()&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim strPrmt As &lt;BR /&gt;
String&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
Me.Hide&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; strPrmt = "Select object"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; EntSel (strPrmt)&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT&gt;&lt;BR /&gt;
face=Arial size=2&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Me.Show&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;7. Well that's it basically, now your code should &lt;BR /&gt;
work. If you still don't understand something it's most probably because I'm &lt;BR /&gt;
also&amp;nbsp;quite unfamiliar with VBA. Good luck.&lt;/FONT&gt;&lt;/DIV&gt;&lt;BR /&gt;
&lt;DIV&gt;&lt;FONT face="Arial" size="2"&gt;------------&lt;/FONT&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 04 Feb 2003 22:53:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/detecting-keypress/m-p/302099#M66231</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2003-02-04T22:53:52Z</dc:date>
    </item>
  </channel>
</rss>

