title: Unable to set Pivot Field to Hidden
body: <p>Hopefully this will be an easy one, but I can't find the answer to this particular scenario. I'm using the following code to hide and unhide pivot fields based on user selections. The variable <code>fieldShow</code> is a boolean that is true if the user wants to see that particular field, while <code>fieldLastVal</code> is a boolean that tells whether that field is currently showing or not.</p>
  
  <pre><code>If fieldShow &lt;&gt; fieldLastVal Then
      If fieldShow Then
          With pt.PivotFields(fieldName)
              .Orientation = xlDataField
              .Function = xlSum
          End With
      Else
          pt.PivotFields(fieldName).Orientation = xlHidden
      End If
  End If
  fieldLastVal = fieldShow
  </code></pre>
  
  <p>The issue is on the line to hide the pivot field. The thing is, the code executes just fine. No errors, no nothing. However, it never actually hides the pivot field. It's still there as if nothing happened. I stepped through the code, and that line definitely executes, it just has no effect whatsoever on the pivot table, and I don't understand why.</p>
  
  <p>The line that sets a pivot field's orientation to <code>xlDataField</code> has the desired effect. I'm not really sure what's happening here.</p>
  
  <p>Anythoughts?</p>