title: VBA Sub optional parameters with default values
body: <p>I am trying to write a VBA sub that allows optional parameters <strong>with default values</strong>. I tried the sample code from <a href="https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/procedures/optional-parameters" rel="nofollow noreferrer">Microsoft Docs - Optional Parameters (Visual Basic)</a> but it leads to the sub not showing on list of available subs (i.e. from View Macros). </p>
  
  <pre><code>Sub notify(ByVal company As String, Optional ByVal office As String = "QJZ")
      If office = "QJZ" Then
          Debug.WriteLine("office not supplied -- using Headquarters")
          office = "Headquarters"
      End If
      ' Insert code to notify headquarters or specified office.
  End Sub
  </code></pre>
  
  <p>The sub declaration I tried, but couldn't get to appear, was:</p>
  
  <pre><code>Sub HighlightByFont( _
          Optional ByVal highlightFont As Variant = "", _
          Optional ByVal highlightColor As Variant = "", _
          Optional ByVal highlightText As Variant = "", _
          Optional ByVal matchWildcards As Variant = False, _
          Optional ByVal useGUI As Variant = False, _
          Optional ByVal highlightBold As Variant = False, _
          Optional ByVal highlightItalic As Variant = False)
  </code></pre>
  
  <p>For now, I have had to settle for the below with <a href="https://stackoverflow.com/a/48200047/7608812">IsMissing logic</a>:</p>
  
  <pre><code>Sub HighlightByFont( _
          Optional ByVal highlightFont As Variant, _
          Optional ByVal highlightColor As Variant, _
          Optional ByVal highlightText As Variant, _
          Optional ByVal matchWildcards As Variant, _
          Optional ByVal useGUI As Variant, _
          Optional ByVal highlightBold As Variant, _
          Optional ByVal highlightItalic As Variant)
  </code></pre>
  
  <p>Is it (still<sup>†</sup>) possible, and if so, how:</p>
  
  <ol>
  <li>to set up the parameter declaration?</li>
  <li>to get it to appear in the View Macros list?</li>
  </ol>
  
  <p>Environment:</p>
  
  <ul>
  <li>Word 2016 x64 </li>
  <li>Windows 10</li>
  </ul>
  
  <p><sup><sup>†</sup> All references, including SO answers related to VBA optional paramaters are from 2015.</sup>  </p>