title: VBA Well-hidden macro
body: <p>I'm working on an inherited spreadsheet (creation date 1998, or maybe earlier) and need to change the references on a dialog sheet. I can't see the macro in the run macro list,  or anything similar, the sheet itself doesn't show up in the VBA project explorer window, which sounds like it could be an Excel 4.0 macro from other questions I've read here. A lot of people suggest rewriting an Excel 4.0 macro from the beginning, but the problem is that I don't actually know what the macro does.</p>
  <p>Specifically, the macro is linked to a command button, and when I click on 'Assign macro', the name of the macro is written in the 'Macro name' text box, but it's not actually listed in the drop-down menu. If I try to assign this macro to another command button by typing the same name into the 'Macro name' text box, I get an error that the macro is unavailable.<br />
  (Screenshot link: <a href="https://imgur.com/HlxvLV2" rel="nofollow noreferrer">http://imgur.com/HlxvLV2</a>)</p>
  <p>I tried using the solution here (<a href="https://stackoverflow.com/questions/14600309/cannot-see-excel-sheet-in-vbe">Cannot see excel sheet in VBE</a>), and because the sheet I'm interested in is not actually a worksheet, I declared ws as a dialog sheet.</p>
  <pre><code>Public Sub TestAccessToXL4MacroSheet()
  
  Dim ws As DialogSheet
  Set ws = ThisWorkbook.ActiveSheet ' succeeds
  Debug.Print ws.Name               ' outputs &quot;Macro1&quot;
  Set ws = Worksheets(&quot;Macro1&quot;)     ' fails: &quot;Subscript out of range&quot;
  
  End Sub
  </code></pre>
  <p>The result is that the name of the sheet appears in the immediate window.
  (Screenshot link: <a href="https://imgur.com/C1L2SQP" rel="nofollow noreferrer">http://imgur.com/C1L2SQP</a>)</p>
  <p>Is this the intended result? I can already see the sheet name as a tab, I want to see the sheet itself in the VBA editor.</p>