- 积分
- 142
- 明经币
- 个
- 注册时间
- 2011-11-10
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
代码如下:
Public Function jiyouguimianxian()
Dim excelApp As Excel.Application
Dim excelSheet As Excel.Worksheet
Dim strFile As String
strFile = ThisDrawing.Application.VBE.ActiveVBProject.fileName
Set excelApp = CreateObject("Excel.Application")
excelApp.Visible = False
excelApp.Workbooks.Open Left$(strFile, Len(strFile) - Len("ex01.dvb")) & "\Excel\demo.xls"
Set excelSheet = excelApp.ActiveWorkbook.Sheets("Sheet1")
Dim verts As New cls2dPointArray
Dim vert(0 To 1) As Double
Dim i As Integer, a As Double, b As Double
For i = 2 To excelSheet.[C65536].End(xlUp)
a = 910 + (Cells(i, 1).Value - Cells(1, 1).Value) / 10
b = 370 + Cells(i, 3).Value - Cells(2, 3).Value
verts.Append vert
vert(0) = a
vert(1) = b
Next i
Dim mspace As New clsModelSpace
mspace.AddLWPolyline verts.toarray()
End Function
问题出现在a、b处,运行到a的时候就提示类型不匹配,怎么回事?
excel中的数据如下:
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?注册
x
|