title: How to pass arguments from text to macro in VBA
body: <p>When assigning a shape a macro, I am aware you can pass the shape as an argument like this:</p>
  
  <pre><code>Sub DoSomething(CShp as Shape)
      'code here using CShp as shape obj
  End Sub
  </code></pre>
  
  <p>In PowerPoint you can also highlight text and assign it a macro when clicked. Would it be possible to pass the text that has been clicked as an argument? I've tried the following ideas to no avail:</p>
  
  <pre><code>Sub GetText(ShpText as Textframe)
  'Nothing passes
  End Sub
  
  Sub GetText(ShpText as TextRange)
  'Nothing passes
  End Sub
  
  Sub GetText(Shp as Shape)
  Dim TxtRng as TextRange
  Set TxtRng = Shp.TextFrame.TextRange
  'Passes the whole text but not the clicked text only
  End Sub
  </code></pre>
  
  <p>Many thanks</p>