title: unable to save excel sheet via vb2010
body: <p>I am unable to save excel sheet through an application I have developed in vb 2010.It is able to create a file and is entering all the data assigned but gives a COM exception unhandled when it hits the save command:-<br><br> xlWorkBook.SaveAs("C:\ABC", "xlsx")<br><br> I have added references to excel in my visual studio 2010.</p>
  
  <p>Below is the code i am using:-</p>
  
  <pre><code>Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
  
      Dim xlApp As New Excel.Application
      Dim xlWorkBook As Excel.Workbook
      Dim xlWorkSheet As Excel.Worksheet
  
      'Add a New Workbook
      xlWorkBook = xlApp.Workbooks.Add
  
      'Display Excel
      xlApp.Visible = False
  
      'Set the relebant sheet that we want to work with
      xlWorkSheet = xlWorkBook.Sheets("Sheet1")
  
      With xlWorkSheet
          'Directly type the values that we want
          .Range("A1").Value = "Company Name"
          .Range("A2").Value = "Product Name"
          .Range("A3").Value = "Budget"
          .Range("A4").Value = "Expected Delivery"
  
          .Range("B1").Value = "hi"
          .Range("B2").Value = "hh"
          .Range("B3").Value = "qw"
          .Range("B4").Value = "qw"
      End With
  
      'Save the file
      xlWorkBook.SaveAs("C:\ABC", "xlsx")
  
      'Close the file
      'xlWorkBook.Close()
  
  End Sub
  </code></pre>