title: Excel 2007 VBA will not change Chart name
body: <p>I have the following code</p>
  
  <pre><code>Sub Foo()
      Dim Graph As Chart
      Set Graph = AddGraph()
      Graph.name = "XXXX"
  End Sub
  
  Function AddGraph() As Chart
      Dim Graph As Chart
      '
      '
      '
      Graph.name = "XXXX"
      Set AddGraph = Graph
  End Function
  </code></pre>
  
  <p>(Note that it is VBE that lowercases "name".) </p>
  
  <p>In AddGraph, Graph is created with <code>Name="ChartXX"</code>. The assignment statement does NOT change the name. </p>
  
  <p>In Foo, when the name assignment statement is executed, control is kicked all the way up to the top of the calling stack. (Other manipulations of Graph cause no problems.) </p>
  
  <p>So I have two questions: </p>
  
  <p><strong>1</strong>) Why doesn't the name-change work in AddGraph? and </p>
  
  <p><strong>2</strong>) Why is the name-change later crashing in Foo?</p>