Dear All am getting a error Like bellow .
 
 
 The process cannot access the file 'file path' because it is being used by another process?
 
 
 
am pasting my code here please find it
 
 
C#
  public void ReadHTMLConvertToExcel()
        {

            string path = sourcePath;
            var d = new DirectoryInfo(path); //Assuming Test is your Folder
            var files = d.GetFiles("*.html"); //Getting Text files
            if (files.Length > 0)
            {
                foreach (var file in files)
                {
                    var app = new Excel.Application();
                    try
                    {

                        var fullPathnew = d + file.Name;

                        FileInfo fi = new FileInfo(fullPathnew);
                        if (fi.IsReadOnly == true)
                        {
                            fi.IsReadOnly = false;
                        }
                        var wb = app.Workbooks.Open(fullPathnew);

                            if (File.Exists(targetPath + file.Name.Replace(".html", ".xls")))
                            {
                                File.Delete(targetPath + file.Name.Replace(".html", ".xls"));
                            }

                            wb.SaveAs(targetPath + file.Name.Replace(".html", ".xls"), Excel.XlFileFormat.xlExcel7);// Converting HTML files into Excel File
                            wb.Close();

                        //  File.Delete(sourcePath + file.Name);
                    }
                    catch (Exception ex)
                    {
                        string status = ex.Message;
                    }
                    finally
                    {
                        app.Quit();
                    }

                }
            }
        }
 give me solution please ,
 
when am running the same application then am getting the above error please solve any one .