Sub excell() Dim x, y As Variant Dim i As Integer Dim Excel As Excel.Application Dim ExcelSheet As Object Dim ExcelWorkbook As Object On Error Resume Next Set Excel = GetObject(, "Excel.Application") If Err <> 0 Then Set Excel = CreateObject("Excel.Application") End If Set ExcelWorkbook = Excel.Workbooks.Open("d:\基础数据.xls") Set ExcelWorkbook.Visible = True Set ExcelSheet = ExcelWorkbook.Worksheets("基础数据") ExcelSheet.Activate x(0) = 0: x(1) = 0: x(2) = 0 For i = 1 To 50 y(0) = ExcelSheet.cells(i, 1).Value y(1) = ExcelSheet.cells(i, 2).Value y(2) = 0 Call ThisDrawing.ModelSpace.AddLine(x, y) x = y Next End Sub …………………………………………………………………… 我的本意是从excel文件(50行、2列)中读取数据,分别作为横纵坐标,Z坐标赋值为0,然后画线 程序不报错,也没反应,不知为何?
|