当使用下列语句时会出现错误 Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(App.Path & "/output.xls ") '创建EXCEL应用类
Dim i As Integer, c As Integer, r As Integer, j As Integer
将定义改为如下即可
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open(App.Path & "/output.xls ") '创建EXCEL应用类
Dim i As Integer, c As Integer, r As Integer, j As Integer
如果出现用户定义类型未定义的错误的话,一般要在添加引用。在工程-〉引用,找到对应的引用,添加进去应该可以解决。