title: VBA, Excel: Can .OnAction value be set to a Public Sub which is in ThisWorkbook
body: <p>VBA Geniuses:</p>
  
  <p><em>Question 1:</em>  Is it possible to set the <strong>.OnAction</strong> value of a menu option to a Public Sub which is in <strong>ThisWorkbook</strong> or must the sub be in a <strong>module</strong>?</p>
  
  <p>This works: ViewTextFile() is a public sub in a <strong>module</strong></p>
  
  <pre><code>.Controls(strMenuItem).OnAction = "'ViewTextFile """ &amp; strMenuItem &amp; """'"
  </code></pre>
  
  <p>I would like to move the sub to <strong>ThisWorkbook</strong>, so the value becomes something like this:</p>
  
  <pre><code>.Controls(strMenuItem).OnAction = "'" &amp; ThisWorkbook.Name &amp; "!ViewTextFile """ &amp; strMenuItem &amp; """'"
  </code></pre>
  
  <p><em>Question 2:</em>  If the answer to #1 is yes, then what is the syntax for getting the reference to "ThisWorkbook" into the .OnAction command?  </p>
  
  <p>Note that the parameter <strong>strMenuItem</strong> must be included in the value (as in, "ViewTextFile my_file.txt").  I have tried many variations of the above but no success.</p>
  
  <p>Thank you, VBA geniuses!</p>