Set xlApp = CreateObject("Excel.Application")报错,请大神帮忙
我已经在工程-部件里引用了excel11.0objectlibraryPrivateSubCommand1_Click()DimxlAppAsExcel.Applicat...
我已经在工程-部件里引用了excel 11.0 object library
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim FileName, SheetName As String
FileName = "c:\SeatSys.xls"
SheetName = "Seat"
Set xlApp = CreateObject("Excel.Application") ‘这句报错 提示 active x 部件不能创建对象
Set xlBook = xlApp.Workbooks.Open(FileName)
xlApp.Visible = True
Set xlSheet = xlBook.Worksheets(SheetName)
xlSheet.Cells(5, 2) = "Nothing"
xlBook.Close (True)
xlApp.Quit
Set xlApp = Nothing
End Sub 展开
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Dim FileName, SheetName As String
FileName = "c:\SeatSys.xls"
SheetName = "Seat"
Set xlApp = CreateObject("Excel.Application") ‘这句报错 提示 active x 部件不能创建对象
Set xlBook = xlApp.Workbooks.Open(FileName)
xlApp.Visible = True
Set xlSheet = xlBook.Worksheets(SheetName)
xlSheet.Cells(5, 2) = "Nothing"
xlBook.Close (True)
xlApp.Quit
Set xlApp = Nothing
End Sub 展开
2个回答
2014-02-24
展开全部
Set xlApp = CreateObject("Excel.Application") ‘这句报错 提示 active x 部件不能创建对象
本机没有安装Excel
本机没有安装Excel
追问
可是我电脑上有excel啊,我装的2003版,难道跟版本有关系?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询