简体   繁体   English

Windows应用程序中Excel的导入语句

[英]import statement for excel in windows application

I am exporting the contents of one excel file data to the other excel file by using the range excel object in a windows application.. while declaring the object, am getting the error like type excel object is not declared.. here is my code. 我通过在Windows应用程序中使用范围excel对象将一个excel文件数据的内容导出到另一个excel文件..在声明对象的同时,遇到了类似未声明excel对象类型的错误。这是我的代码。

  Dim excelApp As excelobject
  'string filePath = "D:\Test.xls"
  excelApp = New Excel.Application()
  excelWorkBook = excelApp.Workbooks.Open(epath)
     excelWorkSheet = (Excel.Worksheet)excelWorkBook.Worksheets.get_Item(1)
  excelWorkSheet.Copy(Type.Missing, Type.Missing)
     excelWorkSheet = excelApp.Workbooks[2].Sheets[1]




 if (excelWorkBook != null)

    excelWorkBook.Close()
  End If

   if (excelApp != null)

    excelWorkBook = excelApp.Workbooks.Open("D:\Test-1.xls")
    excelApp.Quit()

    this.releaseObject(excelWorkSheet)
    this.releaseObject(excelWorkBook)
    this.releaseObject(excelApp)


  End If

你是这个意思?

Imports Microsoft.Office.Interop.Excel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM