title: VBA: Restrict function arguments to only selected values?
body: <p>Is it possible to define a VBA function so it will only accept specific predefined values as parameter values?  As example, if I create a function like this:</p>
  
  <pre><code>Function Test(vTxt as Boolean)
      Msgbox vText
  End Function
  </code></pre>
  
  <p>and call it from any other Sub I have to give True or False for <code>vTxt</code>, and it won't accept any other values.  For example, I can call <code>Test</code> as:</p>
  
  <pre><code>Sub Example ()
      Call Test(True)
  End Sub
  </code></pre>
  
  <p>Like that, can I set up other parameters in the function so that the caller must choose from only predetermined options?  For example:</p>
  
  <pre><code>Function Test2(vTxt as &lt;something&gt;)
      Msgbox vText
  End Function 
  </code></pre>
  
  <p>and when calling <code>Test2</code>, the caller must specify Option 1, Option 2 or Option 3 for variable <code>vTxt</code>.  I don't want to create multiple optional arguments, but just one argument with multiple predetermined values.  What can I use for <code>&lt;something&gt;</code>?</p>