开发者

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.

  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


You mean this?

Imports Microsoft.Office.Interop.Excel
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜