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