title: PowerPoint (or Excel) VBA Capture Coordinates of Mouse Click
body: <p><strong>Some Background:</strong></p>
  
  <p>The quick background is that I am in the research stages of building an add-in for PowerPoint.  My end goal is to develop a CAD Dimensioning Add-in to help expedite the creating of Engineering Presentations.  We have to do a lot of "PowerPoint Engineering" where the general sizes of components are shown on simplified versions of said components created with PPT shapes or screenshots of the CAD geometry itself.  But creating dimensions over and over is tedious.  Each one generally consists of an arrow, 2 lines, and a text box with the dimension value.   </p>
  
  <p><strong>Here is where I need some help.</strong></p>
  
  <p>(If you know how to do the following in Excel, that would work too and I will work to figure the PPT equivalent later.)</p>
  
  <p>In a PowerPoint slide, while in design mode (i.e. not Slide Show Mode), I want to do the following workflow:</p>
  
  <ol>
  <li>In an open UserForm, the user clicks a button called "START"</li>
  <li>The code starts to listen for a left mouse click (LMC) out in the field of the slide itself (It should not respond to a LMC on the actual UserForm, for example if the user needs to drag the UserForm out of the way)</li>
  <li>Upon LMC, coordinates of the cursor are recorded as (x1,y1)</li>
  <li>Repeat steps 2 &amp; 3 to record (x2, y2)</li>
  <li>Do stuff with these coordinates (e.g. draw a dimension between the two coordinates</li>
  </ol>
  
  <p>I believe I can handle all of the coding with the exception step 2, which is why I am here.  I am having much trouble finding a starting point.  Specifically, I need help with how to <em>listen for a LMC</em>.  In words, what envision is the following:</p>
  
  <pre><code>While Listening:
    If LMC = TRUE
      Do Stuff
    End If
  End While 
  </code></pre>
  
  <p>But I don't have the knowledge to code the <code>While Listening</code> part.  I need a nudge in the right direction.</p>
  
  <p>My searches have landed me on the <code>MouseDown</code> event handler pages at MSDN, but in my testing, I don't think that this is what I need.  Its seem as though <code>MouseDown</code> is intended to start a routine when the Mouse is Down on a CommandButton in the UserForm it self.</p>
  
  <p>I have also found this SO post where the only answer seemed to imply that this was not possible without going to great lengths AND the code was possible detrimental to the file itself: <a href="https://stackoverflow.com/questions/29758475/how-to-record-mouse-clicks-in-excel-vba">How to record mouse clicks in Excel VBA?</a>.  (I have no problem going to great lengths and putting in the work, but not if the resulting code has a high likelihood of doing damage as the post seems to suggest.) (Also, the OP was downvoted with no explanation, maybe someone can tell me why so I don't make the same mistake.)</p>