title: Dynamically Create Excel file using C#.net and Microsoft Excel Interop?
body: <p>I'm creating Excel like following:</p>
  
  <pre><code>     class Program
  {
      private Excel.Application app = null;
      private Excel.Application worksheet = null;
      private Excel.Application workbook = null;
      private Excel.Application worksheet_range = null;
  
      //public Program()
      //{
      //    CreateExcelDoc();
      //}
      static void Main(string[] args)
      {
          Program obj = new Program();
          obj.CreateExcelDoc();
      }
  
      public void CreateExcelDoc()
      {
          try
          {
              app = new Excel.Application();
              if (app == null)
                  return;
              app.Visible = true;
              workbook = app.Workbooks.Add(1);////error in this,saying "can not convert from Excel.Workbook to Excel.Application"
  
          }
          catch (Exception ex)
          {
              throw new Exception("CreateExcelDoc: Error" + ex.Message);
          }
  
      }
  }
  </code></pre>
  
  <p>Could anyone pl tell where I'm going wrong?
  Note: I'm following this: <a href="http://msdn.microsoft.com/en-us/library/ms173186%28v=vs.80%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms173186%28v=vs.80%29.aspx</a></p>
  
  <p>Please send me any nice link/solution. I'm using Windows 7 64-bit OS.</p>
  
  <p>Thanks.</p>