title: SSIS Variable Scope Issues
body: <p>I'm trying to iterate over a few Excel files in a document using a foreach loop. So in my Control Flow I drag and drop a For Each Loop Container. I then create a new variable called ExcelFilePath and put it under the foreach loops scope:</p>
  
  <p><img src="https://i.stack.imgur.com/PQ8Jj.png" alt="enter image description here"></p>
  
  <p>I then edit the foreach loop and set it's variable mapping to map to the created variable:</p>
  
  <p><img src="https://i.stack.imgur.com/yDG1B.png" alt="enter image description here"></p>
  
  <p>Great. So now at this stage I'm assuming that with every iteration this foreach loop does, it's going to store the file path (or whatever) to the current excel file in that variable.</p>
  
  <p>Next I insert a Data Flow Task and add an Excel Source. Initially I create an Excel connection manager, just to point to the correct sheet in the document and specify what columns I want. I test it and see that the preview works nicely.</p>
  
  <p><img src="https://i.stack.imgur.com/QJCdm.png" alt="enter image description here"></p>
  
  <p>Nice. So next I want to change the connection manager, so that it doesn't map to the same file the whole time, but instead uses the variable that the foreach loop sets, specifying what file to use. So I right click on the Excel Connection Manager > Properties, and add an expression. I choose 'ExcelFilePath' for the 'property' and I look for the ExcelFilePath variable that I created that will be in the foreach loops scope.. But nothing. Nowhere to be found.</p>
  
  <p><img src="https://i.stack.imgur.com/iZvZk.png" alt="enter image description here"></p>
  
  <p>What is it that I'm doing wrong here? I've followed various tutorials on the subject to the letter, yet on my side the foreach variable just is nowhere to be found??</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I then went ahead and changed the scope of the variable from the foreach loops scope to 'package' scope. And hey I can now see it, perfect. I select it and this happens:</p>
  
  <p><img src="https://i.stack.imgur.com/w9CrA.png" alt="enter image description here"></p>
  
  <p><strong>EDIT 2</strong></p>
  
  <p>Finally got that working, yet now I have yet <em>another</em> error:</p>
  
  <p><img src="https://i.stack.imgur.com/ADfx0.png" alt="enter image description here"></p>
  
  <p>I honestly don't know how anyone can get any work done using this. I take my hat off to you. I mean <code>Error Code 0x80004005</code>, what's <em>that</em> supposed to mean?!</p>