title: Programmatically determine if a named range is scoped to a workbook
body: <p>I am attempting what I thought would be a fairly simple vba statement to test whether a named range is scoped to a workbook or a specific sheet. </p>
  
  <hr>
  
  <p>As a test, I have created a new Excel document and added in 6 named ranges. Here is how they are layed out in the <em>Name Manager</em>:  </p>
  
  <pre><code> Name         |   Refers To          |   Scope
   -------------+----------------------+-----------
   rng_Local01  |   =Sheet1!$A$2:$A$16 |   Sheet1
   rng_Local02  |   =Sheet1!$C$2:$C$16 |   Sheet1
   rng_Local03  |   =Sheet1!$E$2:$E$16 |   Sheet1
   rng_Global01 |   =Sheet1!$B$2:$B$16 |   Workbook
   rng_Global02 |   =Sheet1!$D$2:$D$16 |   Workbook
   rng_Global03 |   =Sheet1!$F$2:$F$16 |   Workbook
  </code></pre>
  
  <hr>
  
  <p>I would expect that running:</p>
  
  <pre><code>For i = 1 To ThisWorkbook.Names.Count
      If ThisWorkbook.Names(i).WorkbookParameter Then Debug.Print ThisWorkbook.Names(i).Name
  Next i
  </code></pre>
  
  <p>would result in the three <code>Workbook</code> scoped named ranges to be logged, however, nothing happens. There is no error. The <code>.Names(i).WorkbookParameter</code> evaluates to <code>False</code> on <strong>ALL</strong> of the named ranges and I am not sure why.</p>
  
  <hr>
  
  <p>Looking through the <code>Name</code> object in the VBA help I came across <code>ValidWorkbookParameter</code> which looks like the <em>ReadOnly</em> cousin of <code>WorkbookParameter</code>, however using that method does NOT make any difference.</p>
  
  <p>I have also tried explicitly setting <code>ThisWorkbook.Names(i).WorkbookParameter = True</code>, however this results in an error:</p>
  
  <blockquote>
    <p>"Invalid procedure call or argument"</p>
  </blockquote>
  
  <p>Despite the fact that <code>WorkbookParameter</code> is listed as being <em>Read/Write</em></p>
  
  <hr>
  
  <p>Can anyone shed any light onto why this isn't working as I'm expecting it too? Have I misunderstood how <code>Name.WorkbookParameter</code> is supposed to work? Is anyone able to get this to run successfully?</p>