2 huanjue562008 huanjue562008 于 2014.04.07 17:10 提问

VS2010 读写excel2010的程序

Unable to cast COM object of type 'Microsoft.Office.Interop.Excel.ApplicationClass' to interface type 'Microsoft.Office.Interop.Excel._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000208D5-0000-0000-C000-000000000046}' failed due to the following error: 加载类型库/DLL 时出错。 (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
用VS2010VB.net的程序,已经添加了Microsoft Excel 14.0 Object Library 库了,
按键按下的程序如下,但是程序运行到 appXL.Visible = True就出现了上面的错误
Imports Excel = Microsoft.Office.Interop.Excel
Public Class Form1

Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

Dim appXL As Excel.Application

Dim wbXl As Excel.Workbook

Dim shXL As Excel.Worksheet

Dim raXL As Excel.Range

appXL = CreateObject("Excel.Application")

appXL.Visible = True

wbXl = appXL.Workbooks.Add

shXL = wbXl.ActiveSheet

End Sub
End Class

Csdn user default icon