0
我通過在Windows應用程序中使用範圍Excel對象將一個Excel文件數據的內容導出到另一個Excel文件中。在聲明對象時,出現類似Excel類型的對象沒有聲明..這是我的代碼。在Windows應用程序的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