开发者

import statement for excel in windows application

开发者 https://www.devze.com 2023-01-30 20:35 出处:网络
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 o

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

精彩评论

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