title: Programmatically change the sheet name of a Excel File
body: <p>Whats the easiest way to change a sheet name of a newly create .xls file using VB.net.</p>
  
  <p>The .xls is created as follows in a directory location:</p>
  
  <pre><code>filename = strDirectoryName &amp; "\1-TestFeedFile-" &amp; strToday &amp; "-" &amp; iFile.ToString() &amp; "of" &amp; totalFile.ToString() &amp; ".xls"
  
  outputWriter = File.CreateText(filename)
  </code></pre>
  
  <p>The header of the xls file is created as follows:</p>
  
  <pre><code> line = "Blah1" &amp; Chr(9) &amp; "Blah2" &amp; Chr(9) &amp; "Blah3" &amp; Chr(9)
  
  outputWriter.WriteLine(line)
  </code></pre>
  
  <p>This code was orginally written to create a .txt file but was changed to a create a .xls, in that case I'm wondering if i'll have to change the code to create an new excel object which then can be used and access its sheet property?</p>
  
  <p>I don't mind if the solution is in VB.net or C#</p>