请教大侠关于VB调用excel图标的问题
代码如下:Private Sub Command1_Click()
Dim ct As Object
Set ex = CreateObject("excel.application")
ex.Workbooks.Add
ex.Range("A1").Value = "系列一"
ex.Range("A2").Value = 8
ex.Range("A3").Value = 16
ex.Range("A4").Value = 7
ex.Range("A5").Value = 22
ex.Range("A6").Value = 13
ex.Range("A7").Value = 12
ex.Range("A8").Value = 5
ex.Range("A1").Value = "系列二"
ex.Range("B1").Value = 6
ex.Range("B2").Value = 62
ex.Range("B3").Value = 16
ex.Range("B4").Value = 46
ex.Range("B5").Value = 53
ex.Range("B6").Value = 4
ex.Range("B7").Value = 2
ex.Range("B8").Value = 6
ex.Range("A1", "B8").Borders.LineStyle = xlContinuous
ex.Cells(, 1).ColumnWidth = 4
ex.Cells(, 2).ColumnWidth = 4
Set ct = ex.Worksheets("sheet1").ChartObjects.Add(0, 80, 150, 150)
ct.Chart.ChartWizard Source:=ex.Worksheets("sheet1").Range("A2;B8"), gallery:=xlLine, Title:="NEW CHART"
ex.Visible = True
ex.ActiveWindow.slectedsheets.PrintPreview
ex.Visible = False
ex.Worksheets("sheet1").ChartObjects.Delete
ex.ActiveWorkbook.Close savechanges:=False
End Sub
但是系统老是提示“应用程序定义错误或对象错误”,我是个刚学VB的菜鸟,望各位大侠指点下。
补充:VB , 基础类